View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default MsgBox that will open only once.

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]





On Fri, 8 Jan 2010 10:18:04 -0500, "John" wrote:

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