locked
IE is busy when using VBA and IE RRS feed

  • Question

  • I wrote the code like this and but IE is always busy and could not get out while loop.

    How could I solve that ?

    Public Sub test()
    Dim IE As New InternetExplorerMedium
    IE.Visible = True
    IE.Navigate "http://downloadcenter.trendmicro.com/index.php?regs=jp&clk=jp_patterns"

    Do While IE.Busy Or IE.ReadyState <> 4
        DoEvents
    Loop

    Tuesday, July 15, 2014 12:16 AM

Answers

  • It's always worth including a time-out to any indeterminate loop, eg in this example only 2 seconds

    Sub test2()
    Dim bFlag As Boolean
    Dim bAbort As Boolean
    Dim timeOut As Single
    
        timeOut = Timer + 2
        bFlag = True
    
        Do While bFlag And Not bAbort
    
            If Timer >= timeOut Then
                If MsgBox("Abort ?", vbYesNo) = vbYes Then
                    bAbort = True
                Else
                    timeOut = Timer + 2
                End If
            End If
        Loop
    
    End Sub

    • Marked as answer by danishani Tuesday, November 11, 2014 12:05 AM
    Tuesday, July 15, 2014 12:41 PM