How to Popup Message Box When Opening A Workbook in Excel

,

This post will guide you how to create a pop up message box when you open a workbook in Excel. How do I create a message box in Excel using VBA and pop up whenever you open your workbook or excel file in Excel.

Display Message Box When Opening a Workbook


If you want to display a message box when a particular workbook is opened, you can use an Excel VBA macro to achieve the result. Just do the following steps:

Step1: open your excel workbook and then click on “Visual Basic” command under DEVELOPER Tab, or just press “ALT+F11” shortcut.

Get the position of the nth using excel vba1
Step2: then the “Visual Basic Editor” window will appear.

Step3: double click on ThisWorkbook object under VBAProject pane, and the Code window for “ThisWorkbook” should be appear.

message box when open excel file1

Step4: copy and past the below VBA Macro code into the code window.

Private Sub Workbook_Open()
    MsgBox "pop up message box"
End Sub

Step5: click Save button, that save this workbook as Excel macro-Enabled Workbook, you need to select Excel Macro-Enabled Workbook from the Save as type list box.

message box when open excel file2

Step6: reopen that workbook with VBA Macro, and you will see a security warning message at the top of the current worksheet. Click Enable Content button to activate the VBA macro.

message box when open excel file3

Step7: A message box should be popped up.

message box when open excel file4

 

 

 

 

Leave a Reply