set timeout value on CreateObject("InternetExplorer.Application")

sample code:

Set myIE = CreateObject("InternetExplorer.Application")
myIE.navigate ""

Do Until myIE.Busy = False

How can i set the timeout value for the http request?

Who is Participating?
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.

the easy way is to use the timer control
dim bTimeOut as boolean

bTimeOut = False
Do Until myIE.Busy = False or bTimeOut

Private Sub Timer1_Timer()
bTimeOut = true
end sub

the hard way would be to use the timer api functions

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

 - create a timer control and a command button
 - paste this code:
Dim myIE As Object
Dim ElapsedTime As Integer

Private Sub Form_Load()
    Timer1.Enabled = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set myIE = Nothing
End Sub

Private Sub Command1_Click()
    Set myIE = CreateObject("InternetExplorer.Application")
    myIE.Visible = True
    myIE.navigate ""

    ElapsedTime = 0
    Timer1.Interval = 1000
    Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
    If myIE.busy = False Then
        MsgBox "Done!"
        ElapsedTime = ElapsedTime + 1
        If ElapsedTime = 10 Then
            MsgBox "Time-out!"
            Timer1.Enabled = False
        End If
    End If
End Sub
You can use DateDiff to compare 2 times, in this case we can see when the request has exceeded our time limit.

Dim lSeconds As Long
Dim dtStart As Date

'Set a 3 second timeout
lSeconds = 3
'Get the time before navigating
dtStart = Now
myIE.Navigate2 ""

'Check the time against the start time
Do While (myIE.ReadyState <> READYSTATE_COMPLETE)
    If (DateDiff("s", dtStart, Now) > lSeconds) Then
        Debug.Print "Time Out"
        Exit Do
    End If
>>How can i set the timeout value for the http request?
IE has it's own time-out so to avoid conflicts with it, you may want to change IE's time-out instead.;en-us;181050

If you don't think your custom time-out will exceed IE's, the above suggestions would be better.
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.