Listing html Title tag in a spreadsheet.

G

Gustavus Vasa

I have reached the end of my limited knowledge.

I am dealing with a large number of html files where the file name bares no
resemblance to the contents.

I can put a list of all the files in the column B of my spreadsheet.

What I need to do is put the text between the <title> and </title> tags in
the next column.

I am running excel 2002, but if this could work for 2000 so I could use it
at work it would be cool.

Regards
Steve the dropbear
 
K

keepitcool

Following should do it..
...change directory before running it

Sub ReadTitles()
Dim wb As Workbook, rng As Range, r&, sFile$
Set rng = ActiveCell
sFile = Dir("*.htm*")
Application.ScreenUpdating = False
While sFile <> ""
Set wb = Workbooks.Open(sFile)
r = r + 1
rng(r, 1) = wb.Name
rng(r, 2) = wb.BuiltinDocumentProperties("Title")
wb.Close
sFile = Dir
Wend
Application.ScreenUpdating = True
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
Top