Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / October 2005

Tip: Looking for answers? Try searching our database.

Retrieve web page Title from URL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Kinata - 06 Oct 2005 18:35 GMT
Hi all,

I'd like to click a button on my Contact form that takes a
web page URL, retrieves the <title> element from the website,
and puts it into another Contact field.

Can anyone point me to an OL VBA example that can grab
a <title> associated with a URL?

Regards,
Chris
Michael Bauer - 06 Oct 2005 21:32 GMT
Am Thu, 6 Oct 2005 10:35:53 -0700 schrieb Chris Kinata:

Chris, this sample should do it. Please add references on "Microsoft
HTML Object Library" and "Microsoft Internet Controls" to your project.

Public Sub LoadWebsite()
 Dim ie As SHDocVw.InternetExplorer
 Dim docHtml As MSHTML.HTMLDocument
 Dim sUrl As String
 
 sUrl = "www.kathrin-kutz.de/index.php"
 Set ie = New SHDocVw.InternetExplorer
 ie.navigate sUrl
 Set docHtml = ie.Document
 Debug.Print docHtml.Title
End Sub

Signature

Viele Gruesse / Best regards
Michael Bauer - MVP Outlook

> Hi all,
>
[quoted text clipped - 7 lines]
> Regards,
> Chris
Chris Kinata - 06 Oct 2005 23:15 GMT
Hi Michael,

Ran this code and got the runtime error

-2147467259 (80004005)
Automation error
Unspecified error

on the statement

   Set docHtml = ie.Document

I've added references to
   Microsoft HTML Object Library
   Microsoft Internet Controls

in the Visual Basic editor within Outlook.

I've Googled this and see some indication that it's associated with
permissions failure. Perhaps there's a zone problem with running this
code in an OL module.

Another idea I had after poking around in the MSDN docs on
Reusing the Browser is that perhaps it would be necessary
to wait until the NavigateComplete2 event fires--maybe
.Document isn't there yet.

Best Regards,
Chris

p.s. Nice paintings!

||||| www.kinata.net web design and hosting

> Am Thu, 6 Oct 2005 10:35:53 -0700 schrieb Chris Kinata:
>
[quoted text clipped - 12 lines]
>  Debug.Print docHtml.Title
> End Sub
Michael Bauer - 07 Oct 2005 09:52 GMT
Am Thu, 6 Oct 2005 15:15:37 -0700 schrieb Chris Kinata:

Chris, using the Complete event is surely a good idea. Please tell us if it
works then.

(Thanks about the paintings! I´m going to tell it the artist.)

Signature

Viele Gruesse / Best regards
Michael Bauer - MVP Outlook

> Hi Michael,
>
[quoted text clipped - 27 lines]
>
> p.s. Nice paintings!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.