Run-Time Error 1004
I've automated a few reports using "Workbook_Open"... Which refreshes pivots,
updates charts, etc... At the end of the day it saves the final product to SharePoint. Its on a scheduler... Most days they run fine however sometimes I get a Run Time Error.. When this occurs, I don't see till I get in the office in morning and I hit Debug + F5 and it completes the process... Is there something I can add to the code to simulate the same step of hitting F5??? Below is where I get hung up Do ActiveWorkbook.SaveAs "http://wellcarelink/sites/CSGeneral/HI_Monthly_Intervals/Monthly/" _ & _ bdFileName & Format(Now(), "_YYYY.MM") & _ ".xls", FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=True, CreateBackup:=False Loop Until ActiveWorkbook.Saved = True |
Run-Time Error 1004
Try adding an on error resume next statement...
On Error Resume Next Do ActiveWorkbook.SaveAs "http://wellcarelink/sites/CSGeneral/HI_Monthly_Intervals/Monthly/" _ & _ bdFileName & Format(Now(), "_YYYY.MM") & _ ".xls", FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=True, CreateBackup:=False Loop Until ActiveWorkbook.Saved = True On Error Goto 0 -- HTH... Jim Thomlinson "THE_RAMONES" wrote: I've automated a few reports using "Workbook_Open"... Which refreshes pivots, updates charts, etc... At the end of the day it saves the final product to SharePoint. Its on a scheduler... Most days they run fine however sometimes I get a Run Time Error.. When this occurs, I don't see till I get in the office in morning and I hit Debug + F5 and it completes the process... Is there something I can add to the code to simulate the same step of hitting F5??? Below is where I get hung up Do ActiveWorkbook.SaveAs "http://wellcarelink/sites/CSGeneral/HI_Monthly_Intervals/Monthly/" _ & _ bdFileName & Format(Now(), "_YYYY.MM") & _ ".xls", FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=True, CreateBackup:=False Loop Until ActiveWorkbook.Saved = True |
All times are GMT +1. The time now is 07:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com