#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default MsgBox

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 331
Default MsgBox

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

"TGalin" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default MsgBox

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.

--
Rick (MVP - Excel)


"TGalin" wrote in message
...
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default MsgBox

Thank you for you're help. It works awesome!

"Greg" wrote:

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

"TGalin" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default MsgBox

Thanks for clearing that up for me. This macro works great! I appreciate
you're help!

"Rick Rothstein" wrote:

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.

--
Rick (MVP - Excel)


"TGalin" wrote in message
...
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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default MsgBox


As an added note there are other components to the message box that you
can use like this:

Code:
--------------------
Private Sub Workbook_Open()
If MsgBox("Your message goes here", vbYesNo, "My Message Box") = vbYes Then
MsgBox "You clicked Yes", vbOKOnly, "Yes Clicked"
Else
MsgBox "You clicked no!", vbOKOnly, "No Clicked"
End If
End Sub
--------------------


Rick Rothstein;270603 Wrote:
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.

--
Rick (MVP - Excel)


"TGalin" wrote in message
...
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



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=75423

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
MsgBox help James C. Excel Programming 2 March 18th 08 09:23 PM
Msgbox not ok A. Karatas Excel Programming 4 April 6th 07 07:50 AM
Msgbox help JonoB Excel Programming 2 October 27th 03 03:06 PM
Msgbox Bernd[_2_] Excel Programming 0 October 24th 03 10:20 AM
MsgBox redmad Excel Programming 1 August 1st 03 12:18 AM


All times are GMT +1. The time now is 09:38 PM.

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"