Consulting

Results 1 to 5 of 5

Thread: IE error message, only when not visible

  1. #1
    VBAX Contributor
    Joined
    Jun 2004
    Location
    Texas
    Posts
    139
    Location

    IE error message, only when not visible

    Hello, all!

    I'm running a procedure that loops through a series of records in a Word document. Part of it involves opening IE and navigating to a URL.

    If IE runs Visible, the code runs perfect. If it runs NOT visible, at a random point (sometimes 14 records, sometime 90), it suddenly encounters an error on the "Navigate" command (something like "the remote application does not exist or is busy").

    Here is an excerpt of the code:
    [vba]
    strURLtest = "https://unx1.shsu.edu:9443/login?" _
    & "url=http://atoz.ebsco.com/titles.asp?lang=en&id=8808&KW=" _
    & strTitle & "&SF=Titles&ST=Exact"
    Set appIE = New InternetExplorer 'WIN XP
    'appIE.Visible = True
    appIE.Navigate strURLtest
    Do Until Not appIE.Busy And appIE.ReadyState = READYSTATE_COMPLETE
    Loop
    strSearchText = "Titles where title name exactly matches '" & strTitle & "': 0"
    [/vba]

    I can't understand why the error occurs only when IE runs not visible, and why it occurs at random, never on the same record. I'm likely doing something wrong--I'm still an amateur.

    I've attached the Word doc with the complete procedure (ReplaceURL); please be aware though that the URLs in the code require login or approved IP, so testing might be difficult unless you change the URL. For further info: this is running on Windows XP, in Word 2007, using IE version 7.0.5730.13.

    Many thanks in advance!!!

    ~eed

  2. #2
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    As a guess, have you tried to minimize the window?

    I am thinking that it could be an add banner or something of that sort. Something that gets called to display something that works when it is visible and doesn't work when the window is not visible.

  3. #3
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    Hard to tell from the code you posted. Are you running a single Instance of IE then looping to navigate, or opening /closing the IE object for each url in the Word Document. If you are positive it will always work if IE is not hidden then minimizing it might be an option. Unfortunately, I don't believe there is a minimize property in the IE Object; however there is a hwnd property, which you could use to obtain the window object and then set that to minimized. Just .02

    P.S. I run scripts nightly that process numerous HTTPS sites and always run IE hidden; any problems are from the URL not my code, and I apply logic to retry.

  4. #4
    VBAX Contributor
    Joined
    Jun 2004
    Location
    Texas
    Posts
    139
    Location
    Thanks for the ideas, Tommy and stanl!

    stanl asked:
    Are you running a single Instance of IE then looping to navigate, or opening /closing the IE object for each url in the Word Document.
    Currently I am opening/closing the IE object each time because I had some issues at first with just trying to re-navigate the same object (though I think I may now have fixed what was causing those issues). Would it be preferable to just re-navigate?

    ~eed

  5. #5
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    Quote Originally Posted by eed
    Would it be preferable to just re-navigate?

    ~eed
    Always. If you find issues with navigating back to the same URL those could be related to caching... dunno. Might want to sort inputs from the Word document; occasionally navigate to about:blank; set URLs up as Trusted Sites; programmatically clear cache... there is just so much that can go wrong with IE and so many places to look for a fix

Posting Permissions

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