Hi all,
If I save my workbook during my session the below code works perfectly, refreshing the query quietly in the background. The problem I am facing is that when I am prompted to save on close the macro will start running (I can see that it starts because of the "retrieving data" status indicator in the bottom right of the excel workbook) and then I will receive a "Microsoft Excel has stopped working" error as the whole thing crashes.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ActiveWorkbook.RefreshAll
End Sub
I'm using Excel 2016. Can someone please help me fix this?
Thanks!
Tyler
If I save my workbook during my session the below code works perfectly, refreshing the query quietly in the background. The problem I am facing is that when I am prompted to save on close the macro will start running (I can see that it starts because of the "retrieving data" status indicator in the bottom right of the excel workbook) and then I will receive a "Microsoft Excel has stopped working" error as the whole thing crashes.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ActiveWorkbook.RefreshAll
End Sub
I'm using Excel 2016. Can someone please help me fix this?
Thanks!
Tyler