ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Message box at file open (https://www.excelbanter.com/excel-programming/288556-message-box-file-open.html)

Hall

Message box at file open
 
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.



John Wilson

Message box at file open
 
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

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





Beto[_3_]

Message box at file open
 
Hall wrote:

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,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.



All times are GMT +1. The time now is 07:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com