Forum Discussion
afifhazim
Feb 17, 2023Copper Contributor
Automate query schedule refresh in Excel while file is not open
Hi, is there a way to automate query refresh in Excel while not opening the file?
HansVogelaar
Feb 17, 2023MVP
Press Alt+F11 to activate the Visual Basic Editor.
Double-click ThisWorkbook under Microsoft Excel Objects in the Project Explorer pane on the left hand side.
Copy the following code into the ThisWorkbook module:
Private Sub Workbook_Open()
Me.RefreshAll
End Sub
Switch back to Excel.
Save the workbook as a macro-enabled workbook (*.xlsm),
Make sure that you allow macros when you open it.
afifhazim
Feb 18, 2023Copper Contributor
Hi HansVogelaar ,
Thank you for your reply. Unfortunately your suggestion does not meet my requirements. I can also trigger my query to automatically refresh when I open the file through the query properties like in the screenshot below.
But what I am looking for is to automate query refresh without even opening the file. I am not sure if it is possible or not.