本帖最後由 CHK 於 2013-9-9 15:22 編輯
小弟甚少接觸PROGRAM 野
所以不太懂
現時找到on error goto
在ws script 用到TRY CATCH statement 嗎?
請問我可以用甚麼CODE令到佢遇到 ERROR時自動終止?
Set excelApp = CreateObject("Excel.Application")
on error resume next
excelApp.Workbooks.Open "XXXXXXX\ABC.xls"
excelApp.Run "COPY"
excelApp.ActiveWorkbook.Close
on error goto 0
excelApp.Quit
Set excelApp = nothing
'Access Query
set accessApp = CreateObject("Access.Application")
on error resume next
accessApp.OpenCurrentDatabase "XXXXXXX\Order.mdb"
accessApp.Run "T1"
accessApp.Run "T2"
accessApp.CloseCurrentDatabase
on error goto 0
accessApp.Quit
set accessApp = nothing |