non responsive web site message/timer

mummbles74

Board Regular
Joined
Nov 14, 2009
Messages
120
Office Version
  1. 365
Platform
  1. Windows
I have this code in a piece of code that I use to copy information from a website into my work sheet.

Set IE = CreateObject("InternetExplorer.application")
IE.Visible = True
IE.Navigate2 "extranet.deritend.co.uk/portal/login.php"
Do
If IE.readyState = 4 Then
IE.Visible = False
Exit Do
Else
DoEvents
End If

The web site is sometime un able to load because it is being updated, what I would like to do is for a msgbox or similar to pop up after a certain amount of time if the webpage has not loaded and use this to end the sub.

Any help appreciated, thank you in anticipation

Mummbles74
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Try something like this:
Code:
Sub IE1()

    Dim IE As InternetExplorer
    Dim URL As String
    Dim timeout As Date
    
    URL = "http://www.mrexcel.com/forum/forumdisplay.php?f=3"
    
    Set IE = New InternetExplorer
    
    timeout = Now + TimeValue("00:00:03")   '3 seconds
    
    With IE
        .Navigate URL
        While .ReadyState <> READYSTATE_COMPLETE And Now < timeout
            DoEvents
        Wend
        
        If .ReadyState <> READYSTATE_COMPLETE Then
            MsgBox "Timeout occurred waiting for " & URL
            .Quit
            Set IE = Nothing
            Exit Sub
        Else
            .Visible = True
        End If
        
    End With
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,676
Members
452,937
Latest member
Bhg1984

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top