Forum Discussion

gcsingh9015's avatar
gcsingh9015
Copper Contributor
Dec 06, 2022

Macro Auto Display alert opening the file

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 ScriptCurrent VBA to save the file automatically before closing the file

  • 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.

Resources