get webpage title from URL

S8utt

Board Regular
Joined
Sep 27, 2005
Messages
126
Has anyone come across a macro / udf which can return the webpage title ?

I want to put a url in cell a1 for example http://uk.msn.com/?st=1

cell a2 I would like to try to return the webpage title, in this example

Hotmail, News, Sport, Music, Movies, Money, Cars, Shopping, Windows Live from MSN UK

I don;t really want the webpages being opened but if the macro udf had to open them, read the title and then close them that is ok.

Thanks for any help given.
 

Some videos you may like

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

dave3009

Well-known Member
Joined
Jun 23, 2006
Messages
7,002
Office Version
365, 2016
Hi

Perhaps try

Code:
Sub GetPageTitle()
Dim a As String
    Set ie = CreateObject("InternetExplorer.Application")
    With ie
        .Visible = True
        .Navigate "http://uk.msn.com/?st=1"
        Do Until .ReadyState = 4
            DoEvents
        Loop
        Sheet1.Range("A1").Value = .document.Title
        .Quit
    End With
End Sub
 
Last edited:

S8utt

Board Regular
Joined
Sep 27, 2005
Messages
126
thanks for the swift responce.

i changed it a little to sut what I wanted.

Code:
Function GetPageTitle(a As String)

    Set ie = CreateObject("InternetExplorer.Application")
    With ie
        .Visible = False
        .Navigate a
        Do Until .ReadyState = 4
            DoEvents
        Loop
        GetPageTitle = .document.Title
        .Quit
    End With

    End Function
thanks again
 

nickrocksall

New Member
Joined
May 30, 2012
Messages
1
Hi ,

Can you help modify it so that i can get the data of table say for table 32 from all webpages in column A and dump the data in column B.

Thanx in Advance :):)
 

Watch MrExcel Video

Forum statistics

Threads
1,095,268
Messages
5,443,446
Members
405,236
Latest member
JDru85

This Week's Hot Topics

Top