VBA - Internet Explorer 'GoBack' method fails

chiekode

New Member
Joined
Mar 29, 2015
Messages
3
Hello,

I'm trying get a simple program to run, where I navigate to a certain website in Internet Explorer, go home and then just go back to previous page.

The code:
Code:
Sub testsub()

    my_url = "http://www.google.de"
    Set ie = CreateObject("InternetExplorer.Application")
   
    With ie
        .Visible = True
        .navigate my_url
        .Top = 50
        .Left = 530
        .Height = 400
        .Width = 400
    End With

    Do Until Not ie.Busy
        DoEvents
    Loop

    'wait
    For i = 0 To 500000000
    Next i

    ie.GoHome
    
    'wait
    For i = 0 To 500000000
    Next i

    ie.GoBack

End Sub

The strange thing is, it works in debug mode (single-step) but not in normal mode. I keep getting the error like: "method GoBack of object 'iwebbrowser2' failed"
My poor waiting-loops are working (they wait a few seconds)

Any ideas?

Thank you!
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
are you sure its not related to updates from ms that prevent vulnerable actions occuring
 
Upvote 0
I've added
Code:
    Do While ie.ReadyState <> 4 'READYSTATE_COMPLETE
        DoEvents
    Loop
after GoHome. Doesn't work either, the state is stuck at "READYSTATE_LOADING" the whole time
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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