Macro Auto Display alert opening the file

Occasional Visitor

Hi,

 

A power shell script is opening an excel file where on opening the file it is set to an automatic data refresh and at last script closes the file. I wrote a simple macro to auto-save the file before file  get closed, after watching a tutorial.

 

I am very new, can you please help me with VBA, the expression error alert comes (PFA) when we open the excel file, just need a VBA code in addition to the existing code which gives application.displayalerts=False on opening the file and keep the file running so data refresh can run, and later follow the existing VBA (PFA) to save the file before closing.

 

Hope I am clear. Kindly suggest.

 

 

 

Display alert on opening the excel file using Power ScriptDisplay alert on opening the excel file using Power ScriptCurrent VBA to save the file automatically before closing the fileCurrent VBA to save the file automatically before closing the file

1 Reply

@gcsingh9015 

Your VBA code runs when the workbook is closed, but the error occurs when the workbook is opened, so it must be caused by code that runs then.