View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff[_4_] Harald Staff[_4_] is offline
external usenet poster
 
Posts: 70
Default how to kill excel using a vbscript

Hi Sofia

Things like these tend to happen when Excel asks for something or prompts something and no
one responds to the message. See if
XL.Visible = True
-just below "createobject"- will reveal something.

--
HTH. Best wishes Harald
Excel MVP

Followup to newsgroup only please.

"Sofia" wrote in message
...
Hello.

I am running a vb script that essentially runs an Excel
macro. The macro itself does not try to reopen the excel
file. Rather it invokes an .exe which prints a set of
labels. Everytime I run the script, I get a message from
the system (after a few seconds) that the excel is file
is available for editing. I've noticed that even though
the script is setting the Excel object to nothing it
still leaves an instance of Excel running. How do I kill
that instances of Excel (or any other application) within
my vb script?

Here is my vb script:

Dim XL
Dim WB
Set XL = CreateObject("Excel.Application")
Set WB = XL.Workbooks.Open("C:\2dseismiclabels.xls")
msgbox("about to print labels")
xl.Run "Macro1"
msgbox("finished printing labels")
wb.save
WB.Close
XL.Quit
Set WB = Nothing
Set XL = Nothing