ExcelChampion
Well-known Member
- Joined
- Aug 12, 2005
- Messages
- 976
Trying to test if an Internet Explorer window is already open. Basically, the macro I have first opend a new instance of IE and then does some stuff and then needs to loop back and use the existing window. However, I just can't seem to get it right. It keeps opening a new instance of IE or it does nothing depending on how I structure the boolean. Doing this a few hundred times is a problem.
FYI, ie is declared as a Public Object
FYI, ie is declared as a Public Object
Code:
Sub PIDQuery()
Dim myRow As Variant
Dim i As Integer
Dim myID As Object, myPassword As Object, BidTypeCd As Object, PartNumOffr0EDrop As Object, overridelink As Object
Dim x As String
myRow = Evaluate("MATCH('Control Form'!B3,'Bid Database'!A:A,0)")
If Not ie Is Nothing Then GoTo again
Set ie = CreateObject("InternetExplorer.Application")
again:
With ie
.navigate "https://www.dibbs.bsm.dla.mil/RA/Quote/QuoteForm.asp?sn=" & WorksheetFunction.Substitute(Sheets("Bid Database").Range("G" & myRow).Value, "-", "") & "&TypeSrch=cq&selection=solicitation&sort=solicitation&scope=all&value=" & WorksheetFunction.Substitute(Sheets("Control Form").Range("G" & myRow).Value, "-", "")
Do Until .readyState = 4: DoEvents: Loop
Do While .Busy: DoEvents: Loop
DoEvents
'do some stuff...
End With
End Macro
Last edited: