[Solved] VBA - Application.DisplayAlerts = False not working if it's running through UiPath

I had a macro that will be executed using UiPath. This code basically takes data from 4 Excel files, which will always be opened by someone, causing a read-only pop-up alert. In the code, I have set DisplayAlerts = False, and it works if I run the code directly in Excel. However, when the code is executed by UiPath, the pop-up still appears.

Is there anyway to stop the alert?

Display Alerts setting in UiPath
image

Excel Scope

Studio 2024.10.1
image

Thanks in advanced.

@Jack_Tsang

Try changing existing process action and file conflict resolution as well

Ideally when running macro you would have opened the excel already so there might not be an issue but in this case the excel is being opened programmatically so first opening happens and then display alerts come into picture

Cheers

Thanks for the reply,

I think “Use Excel file” is to open the excel file, I did try to add a 10s delay in excel app scope before executing the VBA, but it still pops up.

@Jack_Tsang

Yes it is to open after opening these would be applied so displayalerts would come first while opening as that is different

cheers

I tried to open the excel file with excel scope and set a delay for 10s before executing the VBA, the Read Only message still pop. :melting_face:

@Jack_Tsang

Delay would not work

Programmatically if excel is already open either you need to first close and then open and perform or kill and then open

Cheers

Dear anyone who will be struggling this,

I have solved the issue by forcing the target files to open in read-only mode.

Set wb1 = Workbooks.Open("C:\Path\To\File1.xlsx", ReadOnly:=True)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.