Re: parsing Html page

Tech-Archive recommends: Fix windows errors by optimizing your registry



I have no idea what you are asking for. Sorry.

--
Regards,
Tom Ogilvy


"mino" wrote:

Thanks, I will analyze it.

To use Visual studio object in Vb-Excel 2003 where can I find the add in for
excel (reference)?

thanks
M.


"Tom Ogilvy" <TomOgilvy@xxxxxxxxxxxxxxxxxxxxxxxxx> ha scritto nel messaggio
news:B4B48725-99CF-4760-A49C-EC42B791A702@xxxxxxxxxxxxxxxx
http://groups.google.com/group/microsoft.public.excel.programming/browse_frm/thread/dbb500529f30d912?hl=en&lr=&ie=UTF-8&oe=UTF-8

has some suggestions.

--
Regards,
Tom Ogilvy


"mino" wrote:

Hi.
I need to get data from a web page from Excel (no query web).

I need to put in a variable (es. mycode) all the html code, afterwards I
will parse the string "mycode".

I call in my sub a function DownloadPage (API) found in KPD-Team 1999
(see
code below).
It works but sometime the page processed is not completly loaded, so I
lost
some data.

I am not expert, so I ask if there is the possibility to put in a string
the
html code with another method.

Thanks
M.

-------------------------------------------

Option Explicit

Const INTERNET_OPEN_TYPE_DIRECT = 1
Const INTERNET_OPEN_TYPE_PROXY = 3
Const INTERNET_FLAG_RELOAD = &H80000000
Private Declare Function InternetOpen Lib "wininet" Alias "InternetOpenA"
(ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As
String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Private Declare Function InternetCloseHandle Lib "wininet" (ByVal hInet
As
Long) As Integer
Private Declare Function InternetReadFile Lib "wininet" (ByVal hFile As
Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long,
lNumberOfBytesRead As Long) As Integer
Private Declare Function InternetOpenUrl Lib "wininet" Alias
"InternetOpenUrlA" (ByVal hInternetSession As Long, ByVal lpszUrl As
String,
ByVal lpszHeaders As String, ByVal dwHeadersLength As Long, ByVal dwFlags
As
Long, ByVal dwContext As Long) As Long

Private Declare Function InternetAttemptConnect Lib "wininet" (ByVal
dwReserved As Long) As Long



Function DownloadPage(sURL As String, Optional Length As Long) As String
'this sub written by
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@xxxxxxxxxx

Dim hOpen As Long, hFile As Long, sBuffer As String, Ret As Long
'Create a buffer for the file we're going to download

If Length = 0 Then Length = 10000000

sBuffer = Space(Length)
'Create an internet connection
hOpen = InternetOpen("", INTERNET_OPEN_TYPE_DIRECT, vbNullString,
vbNullString, 0)
'Open the url
hFile = InternetOpenUrl(hOpen, sURL, "", 0, INTERNET_FLAG_RELOAD,
ByVal
0&)
'Read the first 10000 bytes of the file
InternetReadFile hFile, sBuffer, Length, Ret
'clean up
InternetCloseHandle hFile
InternetCloseHandle hOpen
'Show our file
DownloadPage = Left$(sBuffer, Ret)

End Function








.



Relevant Pages

  • Re: parsing Html page
    ... so I ask if there is the possibility to put in a string ... Private Declare Function InternetCloseHandle Lib "wininet" (ByVal hInet ... Private Declare Function InternetReadFile Lib "wininet" (ByVal hFile As ... Dim hOpen As Long, hFile As Long, sBuffer As String, Ret As Long ...
    (microsoft.public.excel.programming)
  • Re: HTTP Posting Document
    ... > Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet ... > Private Declare Function InternetConnect Lib "wininet.dll" Alias ... > String, ByVal nServerPort As Integer, ByVal sUserName As String, ByVal ...
    (microsoft.public.word.vba.general)
  • parsing Html page
    ... so I ask if there is the possibility to put in a string the ... html code with another method. ... Private Declare Function InternetCloseHandle Lib "wininet" (ByVal hInet As ...
    (microsoft.public.excel.programming)
  • RE: parsing Html page
    ... so I ask if there is the possibility to put in a string the ... Private Declare Function InternetCloseHandle Lib "wininet" (ByVal hInet As ... Dim hOpen As Long, hFile As Long, sBuffer As String, Ret As Long ...
    (microsoft.public.excel.programming)
  • Re: Datei aus Web auf Platte speichern
    ... Private Const INTERNET_FLAG_RELOAD As Long = &H80000000 ... ByVal sProxyName As String, ByVal sProxyBypass As String, _ ... Private Declare Function InternetCloseHandle Lib "wininet" _ ... (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As ...
    (microsoft.public.de.word.vba)