asking for a VBS Handling advice

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • irGed
    New Member
    • Jul 2011
    • 18

    #1

    asking for a VBS Handling advice

    Hi everyone!

    I have this code that simply opens a .xlsm file and then save it as .xls. The code is working fine, but sometimes at a very small chance, it's already been 10 minutes and the "conversion " is not yet finished, and just leaves an EXCEL.EXE instance on my task manager and a 1890A980.file on my target directory.

    I would like to ask for an advice on how to handle this properly since this functionality is deployed on a server.

    Btw, my vbs is invoke via cscript command.

    The code is:

    Code:
    On Error Resume Next
    Dim ArgObj, var1, var2
    Set ArgObj = WScript.Arguments 
    
    var1 = ArgObj(0) 
    var2 = ArgObj(1) 
    
    Set objExcel = CreateObject("Excel.Application")
    Set objWorkbook = objExcel.Workbooks.Open(var1)
    
    objExcel.DisplayAlerts = 0
    objExcel.ActiveWorkbook.SaveAs var2, 56
    objExcel.ActiveWorkbook.Close
    if err.Number<>0 then
    	WScript.Echo "VB-98," + err.Description
    	else
    	WScript.Echo "VB-00"
    	end if
    objExcel.Quit
    Set	objExcel = Nothing
    set ArgObj = Nothing
    Thanks.
Working...