Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Disable a userform after first use?

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?



  #2   Report Post  
Posted to microsoft.public.excel.programming
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?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Disable a userform after first use?

Thanks. That worked!

"Harald Staff" wrote:

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?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Disable a userform after first use?

Sorry, I actually had a couple of errors in that statement (I made a last
minute change in functions I used and screwed up the change over). Try it
this way and see if it works...

If StrComp(Left(ThisWorkbook.Name, InStrRev(ThisWorkbook.Name, ".") - 1), _
"Mas.ter", vbTextCompare) = 0 Then NotSoFast.Show

--
Rick (MVP - Excel)


"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?




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Disable a userform after first use?

The only problem with what Harald suggested is if your user names his
workbook **anything** starting with the word Master, then the code won't
work as you wanted. For example, if they named it MasterCopy, or Master
Store, or even Mastering, the code would think it had the "MASTER Tally
Sheet".

--
Rick (MVP - Excel)


"Bishop" wrote in message
...
Thanks. That worked!

"Harald Staff" wrote:

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?







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Disable a userform after first use?

Of course, it would have helped if i actually used the name you gave your
master workbook. Try this one instead...

If StrComp(Left(ThisWorkbook.Name, InStrRev(ThisWorkbook.Name, ".") - 1), _
"Master Tally Sheet", vbTextCompare) = 0 Then NotSoFast.Show

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
Sorry, I actually had a couple of errors in that statement (I made a last
minute change in functions I used and screwed up the change over). Try it
this way and see if it works...

If StrComp(Left(ThisWorkbook.Name, InStrRev(ThisWorkbook.Name, ".") - 1),
_
"Mas.ter", vbTextCompare) = 0 Then NotSoFast.Show

--
Rick (MVP - Excel)


"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?




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Disable a userform after first use?

You're absolutely right, Rick. My "I think I'd.." usually need more thinking
<g
Anyway, detecting a template for proper action is pretty tricky. I often
want it to behave differently when found on a shared network drive, on a
SharePoint server, as a local copy or as my development master.

Best wishes Harald

"Rick Rothstein" skrev i melding
...
The only problem with what Harald suggested is if your user names his
workbook **anything** starting with the word Master, then the code won't
work as you wanted. For example, if they named it MasterCopy, or Master
Store, or even Mastering, the code would think it had the "MASTER Tally
Sheet".

--
Rick (MVP - Excel)


"Bishop" wrote in message
...
Thanks. That worked!

"Harald Staff" wrote:

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?







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Disable a userform after first use?

That makes sense. The team has a specific file naming protocol they must use
so "Master" will never be in name of their copy. I should've been more clear
about that in my initial question. I saved the code just in case I need it
later though ;) Thanks again.

"Rick Rothstein" wrote:

The only problem with what Harald suggested is if your user names his
workbook **anything** starting with the word Master, then the code won't
work as you wanted. For example, if they named it MasterCopy, or Master
Store, or even Mastering, the code would think it had the "MASTER Tally
Sheet".

--
Rick (MVP - Excel)


"Bishop" wrote in message
...
Thanks. That worked!

"Harald Staff" wrote:

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?






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable Userform Events Ryan H Excel Programming 1 March 5th 09 05:01 PM
Disable Checkbox on Userform jnf40 Excel Programming 2 October 9th 07 08:40 PM
Userform enable/disable Ozgur Pars[_2_] Excel Programming 1 April 10th 07 11:23 AM
Disable UserForm Objects Sean Connery via OfficeKB.com Excel Programming 1 November 11th 06 06:29 PM
Disable Userform button Trefor Excel Programming 11 November 14th 05 04:04 PM


All times are GMT +1. The time now is 06:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"