Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open an html page from VBA

Status
Not open for further replies.

sabascal

IS-IT--Management
Aug 20, 2002
85
GB
Hi all,

I would like to import the content of an HTML page (url= myURL) into an active worksheet.

What's the best way to do that? Any particular API to do that?

Regards,
Seb
 
Hi all,
This is the methode I used so far:

Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function

Sub test()
MsgBox DownloadFile(" "C:\test.txt")
End Sub


=================================
I still need to copy what's between the <BODY> ...</BODY> tags to paste it into a worksheet. Any hints on how to do that.


Thanks,
Seb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top