Skip to main content
Solved

Run macro command - Pop-up problem

  • June 27, 2024
  • 3 replies
  • 177 views

Forum|alt.badge.img+4

Hi everyone,

I have a question about excel advanced run macro command. I would appreciate it if someone who knows answer.

I am building a bot that will open an excel sheet, run a macro and close it again. But a pop-up appears while the macro is running.Since this pop-up is opened within the run macro command, the bot doesn’t move on to the next action. So capture or keystrokes actions don't work.

Is there another option I can do with AA?

* pop-up: "A file named already exists in this location. Do you want to replace it?"

Can I prevent this pop-up from appearing with a macro code?

Thanks in advance.

Best answer by HemanthaPindra

Hi @ufuksavas,

 

You have to use Application.DisplayAlerts property setting to False in your macro code. It will prevent Excel from displaying most dialog boxes and alerts.

 

Function FunctionName()

Application.DisplayAlerts = False

' Your code here

Application.DisplayAlerts = True ' Reset back to default

End Function

 

Hope it will help.

 

Thanks,

Hemantha Pindra

3 replies

HemanthaPindra
Forum|alt.badge.img+6
  • Navigator | Tier 3
  • Answer
  • June 27, 2024

Hi @ufuksavas,

 

You have to use Application.DisplayAlerts property setting to False in your macro code. It will prevent Excel from displaying most dialog boxes and alerts.

 

Function FunctionName()

Application.DisplayAlerts = False

' Your code here

Application.DisplayAlerts = True ' Reset back to default

End Function

 

Hope it will help.

 

Thanks,

Hemantha Pindra


jon.stueveapeople
Automation Anywhere Team
Forum|alt.badge.img+7

Thank you @HemanthaPindra, for the response. A good rule of thumb is to examine if the target application (Excel) can supress the pop-up displays, as it avoids the rather messy process of trying to automate unnamed windows, timing and focus issues, etc.


Forum|alt.badge.img+4
  • Author
  • Navigator | Tier 3
  • July 1, 2024

Thanks for your response @HemanthaPindra 😀