MsgBox

  • Thread starter Thread starter TGalin
  • Start date Start date
T

TGalin

I know the macro below will give me a message when I run it based on the
message I put between the quotations. I am wondering is there a macro that
will get a message box to pop up when I am open the workbook?

Sub MsgBox
Msgbox "type you're message here" will give me a message boc
End
 
While in VBE, under "Microsoft Escel Objects" you should see a list of your
sheets and one called "This Workbook" Double click "This Woorkbook" then
change the Object drop down (located in the top left of the module pane)
from "(General)" to "Workbook" Excell will put:
Private Sub Workbook_Open()

End Sub
in the module window by default. Then just add your Msgbox code so it looks
like
Private Sub Workbook_Open()
MsgBox "Date fields must be filled in prior to creating new report."
End Sub

Save, exit, and reload.

Greg
 
Not a macro, rather, event code. Here is how to implement it. Right click
the icon immediately to the *left* of the File menu item and select View
Code from the popup menu that appears; then, copy/paste this code into the
code window the opened up...

Private Sub Workbook_Open()
MsgBox "Your message goes here"
End Sub

Note... if when the code window opens up, there is already a Workbook_Open
procedure showing, then just put the MsgBox statement above in it (don't
repeat the Sub..End Sub parts). Now, if you save the workbook, you will get
your message to display (assuming the user permits macros to run) the next
time the workbook is opened.
 
Thank you for you're help. It works awesome!

Greg said:
While in VBE, under "Microsoft Escel Objects" you should see a list of your
sheets and one called "This Workbook" Double click "This Woorkbook" then
change the Object drop down (located in the top left of the module pane)
from "(General)" to "Workbook" Excell will put:
Private Sub Workbook_Open()

End Sub
in the module window by default. Then just add your Msgbox code so it looks
like
Private Sub Workbook_Open()
MsgBox "Date fields must be filled in prior to creating new report."
End Sub

Save, exit, and reload.

Greg
 
Back
Top