chinster99
Technical User
Hi,
The problem I have is that I have about 20 reports scheduled to run on certain days. I have used VBA to refresh the data, make a copy and save the master document. For most of the reports when run in scheduler works fine. However some of the reports does not finish refreshing before it goes to the save part of the code. The weird thing is that it only happens in scheduler, when run normally the code works fine.
The message that comes up is "the action will cancel a pending refresh data command. continue?"
Can anyone help with a method that will make sure the refresh happens each time.
Thanks in advance, code is below
Leo
If ActiveWorkbook.path = origins Then
'if on open the path matches the master doc path then....
ActiveWorkbook.RefreshAll
copy_name = ThisWorkbook.Name
ActiveWorkbook.SaveCopyAs "X:\" & copy_name & ""
LogInformation ThisWorkbook.Name & " was refreshed and saved @ " & _
" " & (Now()) 'log message
ActiveWorkbook.Save ' saves master doc
Application.Quit
The problem I have is that I have about 20 reports scheduled to run on certain days. I have used VBA to refresh the data, make a copy and save the master document. For most of the reports when run in scheduler works fine. However some of the reports does not finish refreshing before it goes to the save part of the code. The weird thing is that it only happens in scheduler, when run normally the code works fine.
The message that comes up is "the action will cancel a pending refresh data command. continue?"
Can anyone help with a method that will make sure the refresh happens each time.
Thanks in advance, code is below
Leo
If ActiveWorkbook.path = origins Then
'if on open the path matches the master doc path then....
ActiveWorkbook.RefreshAll
copy_name = ThisWorkbook.Name
ActiveWorkbook.SaveCopyAs "X:\" & copy_name & ""
LogInformation ThisWorkbook.Name & " was refreshed and saved @ " & _
" " & (Now()) 'log message
ActiveWorkbook.Save ' saves master doc
Application.Quit