0

I want to access Internet Explorer using VBA.

Dim ie As InternetExplorer
Dim i As IHTMLDocument
Dim d As HTMLDocument
Set ie = New InternetExplorer
ie.Visible = True
ie.Navigate "www.google.com"
Set d = ie.Document

I want to use intellisense that is why instead of going for ie.document.get I am using this method.

Getting error like this:

enter image description here

Community
  • 1
  • 1

1 Answers1

0

The issue isn't related with intellisense. All you need is to wait until navigating is completed and IE is ready before accessing document:

Sub Test()

    Dim ie As InternetExplorer
    Dim i As IHTMLDocument
    Dim d As HTMLDocument
    Set ie = New InternetExplorer
    With ie
        .Visible = True
        .Navigate "https://www.google.com"
        Do While .ReadyState < READYSTATE_COMPLETE Or .Busy: DoEvents: Loop
        Set d = .Document
    End With

End Sub

Also take a look at this answer.

Community
  • 1
  • 1
omegastripes
  • 12,351
  • 4
  • 45
  • 96