tebbisch,
You can display a message when a particular workbook opens by putting a MsgBox statement in the Workbook_Open sub. The following code goes in the ThisWorkbook code pane
Code:
Sub Workbook_Open()
MsgBox "This is your friendly pop-up message when the workbook is opened"
End Sub
To paste the sub in the code pane for ThisWorkbook, ALT + F11 to open the VBA Editor then CTRL + R to open the Project Explorer. In the Project Explorer window, doubleclick ThisWorkbook to open its code pane. Paste the code there, then ALT + F11 to return to the spreadsheet.
If you want a message to display when any workbook is opened, then you will need to use a class module. That's somewhat more complicated.
Brad
This will allow you to take action depending upon the response.
Sub Autpen()
Dim Msg, Style, Title, Response
Msg = "Do you want to continue ?"
Style = vbOK + vbDefaultButton2
Title = "Worksheet Directions"
Response = MsgBox(Msg, Style, Title)
If Response = vbOK Then
Else
ActiveWorkbook.Save
ActiveWorkbook.Close
End If
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.