Solved

Such a thing as "Set objIE = CURRENT InternetExplorer" or something equivalent?

Posted on 2006-07-03
5
446 Views
Last Modified: 2008-02-01
Through use of the code below, VB successfully waits for a page with frames to finish loading. While still in the same public sub, if I wanted to navigate to another link I would use the same bit of code minus the first line 'Set objIE'. My problem is that my code sprouts off to another public sub and when I try to tell IE to navigate some where else using the code below minus the first line "Set objIE = New INternetExplorer" I end up getting a 'Runtime error 424 - object required'.

So I insert the first line "Set objIE = New InternetExplorer" and another (not visible) instance of IE sprouts and navigates to the location. I don't want another instance of IE loading, visible or not. I don't want to close out the IE window since that will cause me to have to log back into the webpage. I even tried "Set objIE = InternetExplorer" WITHOUT the 'New' so I could keep using the existing IE window but VB didn't seem to like that idea.  I've tried to search for some word to use that would mean "Current" instead of "New" but I can't find anything.



    Set objIE = New InternetExplorer
    objIE.Visible = True
    objIE.navigate "http://www.yourpage.com"
    While objIE.readyState <> READYSTATE_COMPLETE
        DoEvents
    Wend
    Dim objHTML As HTMLDocument
    Set objHTML = objIE.document
    While objHTML.readyState <> "complete"
        DoEvents
    Wend


0
Comment
Question by:JohnDoeSr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 250 total points
ID: 17034170
you just need to pass the reference to objIE then just

objIE.navigate "http://www.yourpage.com"
    While objIE.readyState <> READYSTATE_COMPLETE
        DoEvents
    Wend
    Dim objHTML As HTMLDocument
    Set objHTML = objIE.document
    While objHTML.readyState <> "complete"
        DoEvents
    Wend
0
 

Author Comment

by:JohnDoeSr
ID: 17034177
How do I pass the reference to objIE? I've only inserted the code above in another public sub and I get a Runtime Error 424 - object required.
0
 

Author Comment

by:JohnDoeSr
ID: 17034224
I'm not sure if it's correct but I've tried passing reference to objIE by doing the following:
Sub Login(ByRef objIE As Object)

The problem is that Sub Login is not called by Sub Form, but instead by a Menu item click. I'm not sure how this will stir things up. I have an Open module opened, but I don't think it can be used in this case.
0
 

Author Comment

by:JohnDoeSr
ID: 17034247
Oh, Sub Form_Load is where the Set ObjIE = new internetexplorer   line is.
0
 

Author Comment

by:JohnDoeSr
ID: 17034540
Looks like sticking

Public objIE As Object

in the module did the trick.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question