Kill Excel Process via VB Script

Using vbscript - looking for a script to kill background instances of Excel.

I have a vbscript that opens an Excel file.  If it errors, Excel stays open in the background, which I don't want.
patriotpacerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Rgonzo1971Commented:
Hi,

Why can't you close them when it errors

   Sub MyMacro()

        On Error GoTo ErrorHandler
        
        Exit Sub

   ErrorHandler:
        ObjExcel.Quit
        Set ObjExcel = Nothing
        Exit Sub

   End Sub

Open in new window

Regards
0
All Courses

From novice to tech pro — start learning today.