Using Excel to report the TITLE of a webpage?

  • Thread starter Thread starter uP..AND..DOWn
  • Start date Start date
U

uP..AND..DOWn

Hi,

I have a list of a large number of addresses from a UK news website in a
Excel sheet.

e.g.

http://......./england/kent/485276.stm
http://......./england/kent/485277.stm
http://......./england/kent/485278.stm

etc. etc.

These are down in a column (A1....A800+). As I'm trying to pick out
particular news items, I need a function to return just the content of the
hypertext element "<TITLE>". Is there an already defined Excel function that
could do this, or do I need to explore the delights of VBA, which I'm new
to?

Any ideas or help?

Many thanks,

Steve
 
Hi Steve,

I don't know of a built-in function to do this. You can do this by
automating IE in a user-defined function (open the VBE with Alt+F11, insert
a new standard module, and paste in this code):

Public Function GETURLPAGETITLE(sURL As String) As String
Dim ie As Object

Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate sURL
Do Until ie.ReadyState = 4
DoEvents
Loop

GETURLPAGETITLE = ie.Document.Title

ie.Quit
Set ie = Nothing
End Function

Then, in your cell, you could use a formula like this:

=geturlpagetitle(A1)

Since you have tons of URLs to get the titles for, you may want to keep IE
open the whole time instead of opening it, navigating to the URL, and
closing it like I'm doing in this function. So a script to run through your
list, navigating to each page, and writing out the titles as you go would be
more efficient.

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]
 

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

Back
Top