Find and use Open Browser

T

Tommy Boy

Hello all,
I have a macro that opens internet explorer and directs the browser to an
internet-based reference set using data I selected on my worksheet as the
search criteria. The sub ends when that is complete, leaving the screen on
the brower. At that point, I usually read the reference material, then go
back to my worksheet, and continue working without closing the brower. Next
time I need to use my macro to start a new search, sub will open a NEW
browser and start the process again, leaving two windows with Internet
explorer open with two different search results. Although this is "okay" I
would really love it if the macro would find the original browser it opened
and use it to start a new search. Is this possible? Below is the portion of
my current code to accomplish what I described above. (The error is in case
I don't have an internet connection and the sub goes to a "plan b".
********
CurrentBook = ActiveWorkbook.Name
ActiveCell.Name = "ClassCode"
Dim ipf As Object

Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = True
.Navigate ("http://intranet address/page.html")
' Loop until the page is fully loaded
Do Until .ReadyState = 4
DoEvents
Loop
On Error GoTo error1
Set ipf = ie.document.form1("text1")
ipf.Value = Range("DATATOSEARCH").Value
ie.document.all.Item("Submit1").Click
Exit Sub
End With

error1:
Dim CCode As New DataObject
Dim MyAppID
ie.Application.Quit

********

Any help on this would be awesome! I'm a VBA newbie, and most of what I
have learned has been from this site, borrowing code the tweaking it with
lots of trial and error! Bottom line: Don't assume that I know anything!
Thanks in advance for your help!
Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top