Killing Excel :)

  • Thread starter Thread starter Nicolas Mainczyk
  • Start date Start date
N

Nicolas Mainczyk

Hi ,

I use the task scheduler to run Excel Macros nightly.

Each morning I have to kill Excel process :(

However, I use 'Application.quit' syntax at the end of each macro and I set
ObjXl=Nothing

How can I automatically kill the process or what can be done to avoid this
'Excel TSR' ?

OS:Win2000
Excel 2000

TIA,
Nicky.
 
Hi Nicolas,

Are you trying to close Excel from within Excel VBA? If so, you may want to
do something like this before you invoke the Quit method:

Sub PrepareToQuit()
Dim wb As Workbook

For Each wb In Workbooks
wb.Saved=True
Next wb
End Sub

That will mark all open workbooks as saved already, so Excel shouldn't hang
out in the background when you Quit. Of course, if you actually want to
save any of the files, you should do that explicitly.
 
Nicky,

I have a similar process but I use the task scheduler to run a
vbscript which has been working well for the past couple of months. I
have posted the script below.

Dim oXL, Wk

Set oXL = WScript.CreateObject("EXCEL.Application")

oXL.Visible = True
Set Wk = oXL.Workbooks.Open("Your file name here")

oxl.Run "Your macro here" 'The name of macro to execute if any

Wk.Save

Wk.Close

oXl.Quit

Set oXL = Nothing
 
Back
Top