我写了下面一个月的VB脚本 ,其目的是:
从那时起,它通过任务计划程序每天都运行良好。但是,今天我收到了一个错误 - 800A03EC - 它引用了第9行的RefreshAll方法。
Option Explicit
Dim xlApp, xlBook, xlSheet
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("G:\MyFolder\MyFile.xlsx")
Set xlSheet = xlBook.worksheets.item(1)
xlBook.RefreshAll
WScript.Sleep(2*60*1000)
xlBook.RefreshAll
WScript.Sleep(2*60*1000)
xlBook.Save
If Weekday(Date()) = 6 Then
xlBook.SaveAs "G:\MyFolder\" & Year(Date()) & "\" & "MyFile - " & DatePart("m", Now) & DatePart("d", Now) & DatePart("yyyy", Now) & ".xlsx"
End If
xlBook.Close
xlApp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
诊断尝试:
此时任何建议都会有所帮助。感谢。