Instantiate IE7 inside Outlok Code

D

Dave the Wave

I was given the following code to create an instance of IE7 inside
Outlook.

Private WithEvents IE As InternetExplorer

Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Debug.Print pDisp.Document.Body.innerText
End Sub

Sub Start()
Set IE = New InternetExplorer
IE.Navigate2 "http://www.vboffice.net"
End Sub

When I tried the code I got a user-defined type error message. Is
there a problem with the syntax above? Could I be missing a reference
to an add-in? (Current references are: 1. VBA, 2. Outlook 12.0 Object
Library, 3. OLE Automation, and 4. Office 11.0 Object Library.)

Thanks for any comments/help!
 
K

Ken Slovak - [MVP - Outlook]

You should have a reference to C:\windows\system32\ieframe.dll. It will show
up as SHDocVW.

I would set it up something like this:

Private WithEvents IE As SHDocVw.InternetExplorer

Sub Start()
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate2 "http://www.vboffice.net"
End Sub
 
D

Dave the Wave

You should have a reference to C:\windows\system32\ieframe.dll. It will show
up as SHDocVW.

I would set it up something like this:

Private WithEvents IE As SHDocVw.InternetExplorer

Sub Start()
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate2 "http://www.vboffice.net"
End Sub

Thank you! That worked perfect.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top