MsgBox that will open only once.

  • Thread starter Thread starter John
  • Start date Start date
Hi Again
I will use Bob's code, but will keep them all, you never know when you'll need
them.
Thank you ALL again
Regards
John
 
Chip adds a third parameter to the Add method, False, which is setting its
visible property, so he is hiding it (as I mentioned in an earlier post).

HTH

Bob

John said:
Hi Chip
Where is that name located. not exactly the same as Bob, I can't find
yours.
Regards
John
Chip Pearson said:
In the ThisWorkbook code module, paste the following code:

Private Sub Workbook_Open()
Dim S As String
On Error Resume Next
S = ThisWorkbook.Names("HasBeenOpened").RefersTo
If S = vbNullString Then
MsgBox "First Time"
End If
ThisWorkbook.Names.Add "HasBeenOpened", "True", False
End Sub

The code looks for a name called "HasBeenOpened". If the name not
found, S will be empty and so the MsgBox will be displayed. If the
name does exist, S is not empty so the MsgBox is not displayed.
Finally, the name is added so that the MsgBox will not be displayed on
subsequent openings.

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]





Hi Everyone
Is it possible to have a popup window ( Msgbox ) that will open only one
time.
The first time the workbook will be open, I would like to show the
message
"Please read the instruction first".
I don't want the message to keep opening every time the workbook is open.
Regards
John
 
Stupid fingers hit ctrl-enter (aka send in my newsreader).

Then I had to go find that link to JE's site. (I spent a lot of time on your
site searching for it, too! (Stupid brain!!!).)
 
Thanks again Bob.
I've got a new problem under different post " Locking the VBA Project"
Maybe you can help me with that one too.
I appreciate all the help you guys are giving.
Regards
John
Bob Phillips said:
Chip adds a third parameter to the Add method, False, which is setting its
visible property, so he is hiding it (as I mentioned in an earlier post).

HTH

Bob

John said:
Hi Chip
Where is that name located. not exactly the same as Bob, I can't find yours.
Regards
John
Chip Pearson said:
In the ThisWorkbook code module, paste the following code:

Private Sub Workbook_Open()
Dim S As String
On Error Resume Next
S = ThisWorkbook.Names("HasBeenOpened").RefersTo
If S = vbNullString Then
MsgBox "First Time"
End If
ThisWorkbook.Names.Add "HasBeenOpened", "True", False
End Sub

The code looks for a name called "HasBeenOpened". If the name not
found, S will be empty and so the MsgBox will be displayed. If the
name does exist, S is not empty so the MsgBox is not displayed.
Finally, the name is added so that the MsgBox will not be displayed on
subsequent openings.

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]






Hi Everyone
Is it possible to have a popup window ( Msgbox ) that will open only one
time.
The first time the workbook will be open, I would like to show the message
"Please read the instruction first".
I don't want the message to keep opening every time the workbook is open.
Regards
John
 
Hi Dave
I won't be playing with the registry with VBA because this is all new to me and
don't really know what I'm doing but will keep it for future, BTW
I've got the save workbook covered in the instruction,so if they don't save,
great, they get the message a second time.
Your comment are always appreciated.
Regards
John
 
Back
Top