Kill Excel Process via VB Script

Posted on 2013-10-22
Last Modified: 2013-10-22
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.
Question by:patriotpacer

Accepted Solution

patriotpacer earned 0 total points
ID: 39591692
LVL 48

Expert Comment

ID: 39591709

Why can't you close them when it errors

   Sub MyMacro()

        On Error GoTo ErrorHandler
        Exit Sub

        Set ObjExcel = Nothing
        Exit Sub

   End Sub

Open in new window


Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now