Problem using oIE.Navigate to grab data from a webpage... it loads in firefox, not in VBA

I have a function that has been working fine.  But I had a system crash and had to do some re-installs and am now having problems.

My system has Internet Explorer and FireFox.  Firefox is my default browser and was before the crash. The function is shown in the code snippet, and it used to work fine, using the InternetExplorer object to grab the text on the given webpage and put it in a string.  But now, when the oIE.Navigate HTTPFileName is executed, it opens the page in Firefox and then it just hangs in the Do Until oIE.ReadyState = READYSTATE_COMPLETE loop, never coming out of it.

I must have some flag somewhere set wrong.

Any suggestions???



Function GetHTTPFile(ByVal HTTPFileName As String, ByVal FullDiskFileName As String, ByVal iFileNum As Integer) As Boolean
    'This requires the Microsoft Internet Controls object reference
    Dim oIE As SHDocVw.InternetExplorer
    Dim sPage As String
    Dim sSymbol As String
    Dim iStart As Long, iEnd As Long
    Dim iRow As Long
    Dim lXMPLoc As Long
    Dim lPRELoc As Long
    Set oIE = New SHDocVw.InternetExplorer
    oIE.Navigate HTTPFileName
    Do Until oIE.ReadyState = READYSTATE_COMPLETE
    sPage = oIE.Document.body.InnerHTML
    If InStr(sPage, "error") Then
        GetHTTPFile = False
    End If
    'Debug.Print sPage
    Debug.Print Left(sPage, 500)
    lXMPLoc = InStr(sPage, "<XMP>")
    If lXMPLoc > 0 Then
        sPage = Mid(sPage, lXMPLoc + Len("<XMP>")) ' was +1 after len
    End If
    Debug.Print Left(sPage, 500)
    lXMPLoc = InStr(sPage, "</XMP>")
    If lXMPLoc > 0 Then
        sPage = Left(sPage, lXMPLoc - 1)
    End If
    lPRELoc = InStr(sPage, "<PRE>")
    If lPRELoc > 0 Then
        sPage = Mid(sPage, lPRELoc + Len("<PRE>"))  ' was +1 after len
    End If
    lPRELoc = InStr(sPage, "</PRE>")
    If lPRELoc > 0 Then
        sPage = Left(sPage, lPRELoc - 1)
    End If
    Open FullDiskFileName For Output As iFileNum
    Print #iFileNum, sPage
    Close iFileNum
    GetHTTPFile = True
    Set oIE = Nothing
End Function

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rory ArchibaldCommented:
As a matter of interest does IE itself work OK - in other words if you open IE and type an address in its address bar and press enter, does it open in IE or in Firefox?
cashonlyAuthor Commented:

It does NOT!

You're on to something there!
Rory ArchibaldCommented:
It might be related to this issue then:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cashonlyAuthor Commented:
You da man!
I can only imagine the hell you went thru to find that before I asked my question!
Rory ArchibaldCommented:
The joys of an IE beta... :) (and yet I keep doing it!)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.