Message box at file open

H

Hall

For a particular Excel file, I want a message box to open as soon as the
file is opened.

Do I need to use VBA for that?

If yes, I'm new to VBA. Any quick pointers?

Thanks all.
 
J

John Wilson

Hall,
Do I need to use VBA for that?
Yes, you do.

From the workbook, press Alt + F11
Double click on "THisWorkbook" in the "Projects" window.
In the panel on the right, copy and paste the following:

Private Sub Workbook_Open()
MsgBox "My message"
End Sub

John
 
B

Beto

Hall said:
For a particular Excel file, I want a message box to open as soon as the
file is opened.

Do I need to use VBA for that?

If yes, I'm new to VBA. Any quick pointers?

Hi, you need to put this code in the Workbook_Open event.

Private Sub Workbook_Open()
Msgbox "This book has just been opened"
End Sub

How do you do this?
Start the Visual Basic Editor (Alt+F11) and go to the Projet Explorer to
the left (where it says project and there is a tree with Microsoft Excel
Objects and Modules). If you don't see it, go to View/Project Explorer.
Now double-click on ThisWorkbook and on the code window put the code I
wrote above. That's all!

Regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top