Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
MsgBox help | Excel Programming | |||
Msgbox not ok | Excel Programming | |||
Msgbox help | Excel Programming | |||
Msgbox | Excel Programming | |||
MsgBox | Excel Programming |