Gustav Brock
gustav at cactus.dk
Sun Oct 12 03:11:46 CDT 2003
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?