+ Reply to Thread
Results 1 to 4 of 4

Problem with scheduler

Hybrid View

  1. #1
    jim simpson
    Guest

    Problem with scheduler

    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



  2. #2
    RB Smissaert
    Guest

    Re: 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" <jimsimpson@cox.net> 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
    >
    >



  3. #3
    jim simpson
    Guest

    Re: Problem with scheduler

    Thanks RBS for the help.

    If that is the way the Scheduler is suppose to work then I have to close
    Excel if it's open. Maybe I can work up a bat file to do it and also start
    the scheduled file, that way everything could be in one file.

    Thanks,

    Jim


    "RB Smissaert" <bartsmissaert@blueyonder.co.uk> wrote in message
    news:usumfO0%23EHA.1604@TK2MSFTNGP12.phx.gbl...
    > 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" <jimsimpson@cox.net> 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
    > >
    > >

    >




  4. #4
    RB Smissaert
    Guest

    Re: Problem with scheduler

    Closing an application is not as easy as opening one and I am not sure a
    ..bat file can do it.
    I would think VB Script can do it, but I couldn't see an easy way.
    Of course what you could do is open the Word file, let it close Excel and
    then let it open
    the Excel file with your code. Then let the Excel file close Word.
    That way everything would be in one file.

    RBS


    "jim simpson" <jimsimpson@cox.net> wrote in message
    news:ZRvGd.77482$Jk5.44137@lakeread01...
    > Thanks RBS for the help.
    >
    > If that is the way the Scheduler is suppose to work then I have to close
    > Excel if it's open. Maybe I can work up a bat file to do it and also start
    > the scheduled file, that way everything could be in one file.
    >
    > Thanks,
    >
    > Jim
    >
    >
    > "RB Smissaert" <bartsmissaert@blueyonder.co.uk> wrote in message
    > news:usumfO0%23EHA.1604@TK2MSFTNGP12.phx.gbl...
    >> 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" <jimsimpson@cox.net> 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
    >> >
    >> >

    >>

    >
    >



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1