PDA

View Full Version : [SOLVED:] Import data from a web page to Excel



mdmackillop
07-16-2005, 02:33 AM
Still working on my KB Search (http://www.vbaexpress.com/forum/showthread.php?t=4107), is there a way to get the data from the KB List (http://www.vbaexpress.com/kb/kblist.php) into my spreadsheet automatically (getting right out of my depth here!)

PS. Finally figured out these clever links as well.

lucas
07-16-2005, 06:51 AM
Try this Malcolm


Option Explicit

Sub gethtmltable()
Dim objWeb As QueryTable
Set objWeb = ActiveSheet.QueryTables.Add( _
Connection:="URL;http://www.vbaexpress.com/kb/kblist.php", _
Destination:=Range("A1"))
With objWeb
.WebSelectionType = xlSpecifiedTables
.WebTables = "12" ' Identify your HTML Table here
.Refresh BackgroundQuery:=False
.SaveData = True
End With
End Sub

mdmackillop
07-16-2005, 09:54 AM
Thanks Steve,
Exactly what I was after.
Regards
Malcolm