[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2006-07-03
5
Medium Priority
?
466 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 750 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

650 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