View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff[_2_] Harald Staff[_2_] is offline
external usenet poster
 
Posts: 449
Default Disable a userform after first use?

The instrrev function goes a character too far for this, so the dot before
file prefix is included:
= "MASTER Tally Sheet."

I think I'd simplify it to
If ThisWorkbook.Name Like "Master*" Then

HTH. Best wishes Harald

"Bishop" wrote in message
...
Ok, I copy/pasted the code right into my VBE. Saved, closed, reopened.
No
userform. So I read up on the components of your code (still a bit over
my
head). The actual name of my spread sheet is "Master Tally Sheet" so I
changed your code to

Private Sub Workbook_Open()
'NotSoFast.Show
If Left(ThisWorkbook.Name, InStrRev(ThisWorkbook.Name, ".", , _
vbTextCompare)) = "MASTER Tally Sheet" Then NotSoFast.Show

End Sub

Saved, closed, reopened. Still no userform. What am I doing wrong?

"Rick Rothstein" wrote:

The name of the UserForm doesn't change when the workbook name changes,
so
your Show shows it. Assuming your MASTER workbook is named "MASTER", then
I
think this code should do what you want, assuming your users do not save
their copy of it under the name MASTER...

Private Sub Workbook_Open()
If Left(ThisWorkbook.Name, InStrRev(ThisWorkbook.Name, ".", , _
vbTextCompare)) = "MASTER" Then NotSoFast.Show
End Sub

--
Rick (MVP - Excel)


"Bishop" wrote in message
...
I have a MASTER spreadsheet that 10 people on the team open. I created
a
userform and set it to open when the spreadsheet opens.

Private Sub Workbook_Open()
NotSoFast.Show
End Sub

I was under the impression that the NAME of the spreadsheet is what
triggered the userform. However, even after I change the name of the
spreadsheet it still opens my userform. What I need is for the
userform
to
come up ONLY when the MASTER spreadsheet is opened. Once the members
of
the
team "save as..." I don't want it to pop everytime they open their
copy.
How
can I make this happen?