OK, I did a little more work to check into this, as this is something that
I will be able to use in the future myself :)
Assuming that the IE window with the desired data is already being
displayed, try the following routine to simply select all of the data in
the IE window, copy it to the clipboard, then paste it onto a worksheet. (I
used the crime stats page from the Houston Police dept. for my neighborhood
as an example
http://www.houstontx.gov/police/cs/s.../oct075f40.htm)
Make sure that you pull down the Tools menu and select References, then add
a reference to "Microsoft Internet Controls" first (I am running Excel 2000
on Windows ME; it might be different on your system).
If the IE window is not already displayed, then I think you would use
CreateObject, instead of GetObject.
'----------------------------------------------------------------------
'References required:
' Microsoft Internet Controls
' C:\WINDOWS\SYSTEM\SHDOCVW.DLL
Public Sub Test()
'Declare Excel variables.
Dim xlApp As Excel.Application
Dim wsData As Worksheet
'Declare IE Browser variables.
Dim IEApp As InternetExplorer
'Set variables to Excel first.
Set xlApp = Application
Set wsData = xlApp.Worksheets("Data")
'Set variables to the browser window.
Set IEApp = GetObject(, "InternetExplorer.Application")
'Fetch the data from the Internet Explorer window.
With IEApp
.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT
.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT
End With
'Re-activate Excel and paste data onto the worksheet.
AppActivate xlApp
wsData.PasteSpecial _
Format:="HTML", _
Link:=False, _
DisplayAsIcon:=False
End Sub
--
Regards,
Bill Renaud