Excel Macro Pop up Issue

  • 18 December 2023
  • 2 replies

Badge +5

Hi Guys,


I am executing a macro using the “Run Macro” command in the Excel Advanced package & facing an issue where the macro is getting executed without any issues but at the end a dialog box comes up which indicates that the macro was successfully executed. It is due to the MsgBox command present at the end of the macro code. 

When the pop up comes up, it does not closes automatically as well as the subsequent lines of code do not get executed in AA & the the code is stuck at “Run Macro” command till someone manually click on the OK button of the dialog box.


Can anyone please help me to overcome this issue?

2 replies

Userlevel 3
Badge +7

Hi @Abhi25 , 

The best solution for you here is to remove the MsgBox action from the Macro code. Else you can try wait and recorder to wait for the window to pop up and then click on the button present in the MsgBox to remove it.


Hope this helps!


Hi @Abhi25,


I know it's quiet late reply, may be useful to someone.


You have to use Application.DisplayAlerts property. Setting it to False it will prevent Excel from displaying most dialog boxes and alerts.


Application.DisplayAlerts = False

' Your code here

Application.DisplayAlerts = True ' Reset back to default



Hemantha Pindra