ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I control Internet Explorer using Excel VBA? (https://www.excelbanter.com/excel-programming/275712-can-i-control-internet-explorer-using-excel-vba.html)

JohnI

Can I control Internet Explorer using Excel VBA?
 
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



Orlando Magalhães Filho

Can I control Internet Explorer using Excel VBA?
 
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 Magalhães Filho

(So that you get best and rapid solution and all may benefit from the
discussion, please reply within the newsgroup, not in email)



"JohnI" escreveu na mensagem
...
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





JohnI

Can I control Internet Explorer using Excel VBA?
 
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

"Orlando Magalhães Filho" wrote in message
...
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 Magalhães Filho

(So that you get best and rapid solution and all may benefit from the
discussion, please reply within the newsgroup, not in email)



"JohnI" escreveu na mensagem
...
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








All times are GMT +1. The time now is 02:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com