Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Message Box (Excel 97)

    I've created a message box macro (MsgBox) to pop up a specific message.

    What I'd like to know is, is there a way to have the macro run automatically when the sheet is first opened? I want the message box to appear when the sheet is first opened to serve notice of some of the features of the sheet.

    Or is there another way of doing this without using a macro, such as a control box, etc.

    Thanks

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message Box (Excel 97)

    Put the code in the Workbook_Open sub in the Thisworkbook module.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message Box (Excel 97)

    I'm pretty new at writing modules, so I think I need some help. Here's what I have originally:
    <hr>
    Sub HyperlinkNotice()
    '
    ' Notice Macro
    ' Macro recorded 10/24/01
    ' Keyboard Shortcut:

    WindowsName = MsgBox("Notice. Use hyperlinks to speed navigation.")

    End Sub
    <hr>
    Question...where to I put in the new code, or what does it replace?

    Thanks again.

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message Box (Excel 97)

    In the VBA editor, double click on the ThisWorkbook object in the project explorer. It the dropdown list at the top left of the edit window select Workbook. In the dropdown list on the right select Open. You should now have the following in the Edit Window:

    <pre>Private Sub Workbook_Open()

    End Sub
    </pre>


    Put your code between those two lines (without your Sub and End Sub lines).
    Legare Coleman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •