Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    XL Hangs on Close (XL97:SR2)

    I am using a "Scheduled Task" on a SERVER to open an Excel file (named File1) which in-turn opens/closes another file (say AnyFlle). Prior to closing AnyFile a range.value is pasted in a cell on File1. The AnyFile is closed (no changes have been made to Anyfile) and the code proceeds to save the activeworkbook and quit the XL application.

    The code runs just fine if I open the file from XL but when it is envoked from the Scheduled Task, the status returned is "Running" and the application never closes down. If I remove GetFile () - Workbooks.Open and Workbooks.Close, everything works just fine.

    The code is as follows:

    Public oPath As String
    Sub Auto_Open()
    oPath =

  2. #2
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: XL Hangs on Close (XL97:SR2)

    Does the GetFile routine run (at all) from the Scheduled Task?
    Gre

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: XL Hangs on Close (XL97:SR2)

    unkamunka,

    The GetFile routing does run from the Schedule Task. I've narrowed it down to the opening of the file (AnyFile) and closing it.

    John

  4. #4
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: XL Hangs on Close (XL97:SR2)

    <hr>no changes have been made to Anyfile<hr>
    If you are merely extracting data from AnyFile, why go to the trouble of opening it?

    Pseudo-code for importing the data could be:

    TargetRange = "=" & SourceFileRange
    TargetRange = TargetRange.Value

    This will achieve the same as opening AnyFile and using a PasteSpecial|Values to import the data.

    Please post back if this is not the right route for you.
    Gre

  5. #5
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: XL Hangs on Close (XL97:SR2)

    unkamunka,

    Thank you for your suggestion. I used John Walker's code for extracting data from a closed file but still had the same issue with XL hanging upon close.

    After spending some time trying to find out why, I realized that the file I was extracting data from was on another server. Once I moved the file to the same server that XL was running on, everything worked fine.

    Apparently there is a timing issue regarding the value being extracted from one file on Server01 and placed in another file on Server02 I bet if I put a wait statement in my original code that would have worked as well.

    Thanks again,
    John

Posting Permissions

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