Problem with scheduler
Seems to me that this is normal behaviour of the Window task scheduler.
This is one way of doing this:
First let the scheduler open a Word document with the following code in the
document open event:
Private Sub Document_Open()
Dim oXL As Object
On Error Resume Next
'get a reference to the running Excel application
Set oXL = GetObject(, "Excel.Application")
If Err.Number = 0 Then
'close Excel
oXL.Application.Quit
End If
Set oXL = Nothing
'close Word
Application.Quit
End Sub
This will close Excel if it was running and close Word.
Then one minute later you run your real task that runs your Excel code.
There might be a nicer way of doing this via a .bat file or via VBScript,
but
I couldn't figure that out quick enough.
RBS
"jim simpson" wrote in message
news:yleGd.76273$Jk5.61837@lakeread01...
Using Windows 98 and Office 2000.
I have a file containing an Excel Macro which starts and runs successfully
whenever the file is opened. But if I run it from Windows Scheduler when
Excel is already open it opens a second copy of Excel which creates other
problems and then hangs..I see nothing in my program which would cause
this,
so maybe it's a feature of Windows Scheduler.
Has anyone run into this problem and can you give me some pointers on how
to
fix it.
Thanks,
Jim
|