[AccessD] Retrieval of picture from an html page (solved)

William Hindman dejpolsys at hotmail.com
Sun Oct 12 06:48:13 CDT 2003


...hah! ...it works! ...another useful bit of code that goes into my stash
...thanks for posting it :)

William Hindman
<http://www.freestateproject.org> - Do you want liberty in your lifetime?


----- Original Message ----- 
From: "Gustav Brock" <gustav at cactus.dk>
To: <AccessD at databaseadvisors.com>
Sent: Sunday, October 12, 2003 4:11 AM
Subject: Re: [AccessD] Retrieval of picture from an html page (solved)


> Well, looks like I never posted the solution I found.
>
> 1. Add a reference to MSInet.ocx.
> 2. Create a form.
> 3. Add the ActiveX control MSInet.ocx to this form.
> 4. Add a button or something else to run this function:
>
> <code>
>
> Public Function RetrieveURLfile( _
>   ByVal strURLFile As String, _
>   ByVal strFilename As String) _
>   As Boolean
>
> ' Example:
> '
> '   strURLFile: "http://www.somedomain.com/files/myfile.zip"
> '   strFilename: "c:\myfiles\myfile.zip"
>
>   Const clngTimeout As Long = 30
>
>   Dim ctlInet As Control
>   Dim abytFile() As Byte
>   Dim intFreeFile As Integer
>
>   If Len(strURLFile) = 0 Or Len(strFilename) = 0 Then
>     ' Nothing to do.
>   Else
>     ' Retrieve file.
>     Set ctlInet = Me!axctlInet
>     intFreeFile = FreeFile
>
>     With ctlInet
>       .RequestTimeout = clngTimeout
>       .Protocol = icHTTP
>       .URL = strURLFile
>       abytFile() = .OpenURL(, icByteArray)
>     End With
>
>     Open strFilename For Binary Access Write As #intFreeFile
>     Put #intFreeFile, , abytFile()
>     Close #intFreeFile
>
>     Set ctlInet = Nothing
>
>     RetrieveURLfile = True
>
>   End If
>
> End Function
>
> </code>
>
>
> How should I retrieve one specific jpg file from an html page?
>
> The file name is always the same but the picture (file) is updated
> frequently. The task is to download the file automatically and (that's
> the easy part) save it using a different name built from the date
> information.
>
> I imagine using a form with a timer event to initiate a download and
> add an entry in a log table.
> But how do I "connect" to the page?
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


More information about the AccessD mailing list