![]() |
Using Excel to report the TITLE of a webpage?
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 |
Using Excel to report the TITLE of a webpage?
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] uP..AND..DOWn wrote: 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 |
All times are GMT +1. The time now is 05:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com