Can I control Internet Explorer using Excel VBA?

  • Thread starter Thread starter JohnI
  • Start date Start date
J

JohnI

Hello there,

I'm fairly good with writing Excel, Word, & Access VBA.

Is there a way to control IE using VBA code?

Any info will be most welcome.

Thanks in advance (TIA),

JohnI
 
Hi Johnl,

Yes. See this code:

Dim IEObj As Object

Sub Test()
OpenIE "http://example.microsoft.com"
End Sub

Public Sub OpenIE(vURL As String)
On Error GoTo ErrorHandler
IEObj.Visible = True
With IEObj
.Visible = True
.Navigate vURL
Do Until Not .Busy
DoEvents
Loop
End With
Exit Sub
ErrorHandler:
Set IEObj = Nothing
Set IEObj = CreateObject("InternetExplorer.Application")
Resume Next
End Sub


HTH
 
Orlando,

I tried out your code & it works just great. Thanks.

Next question - how do I find the Internet Explorer Object Model?
I noticed you used commands such as .Navigate & .Busy.

If there are input boxes & buttons on a web page, can I control them.
Also I want to copy text & paste it into Excel or Word.

regards,

JohnI
 
Back
Top