This works for me. That is, it downloads all the files in the server
folder to my local computer.
It also, (would be removed if not needed), produces a text/ascii
manifestation of the files, and for want of something better to do,
prints that in the immediate window. The text and ascii attributes can
be changed.
Conditions are (mostly a guess) that your server is all MS, that you
have the latest MDAC installed and, of course, that you have access to
the site (username and password). If you try running this code per se I
STRONGLY HOPE it will fail as you will be prompted for a user name and
password.
As always, ... news clients may insert line feeds which will create
syntax errors.
Option Explicit
Public Sub GetRemoteFiles( _
ByVal url As String, _
ByVal destination As String)
Dim c As ADODB.Connection
Dim r As ADODB.Record
Dim rr As ADODB.Record
Dim rs As ADODB.Recordset
Dim s As ADODB.Stream
Set c = New ADODB.Connection
Set r = New ADODB.Record
Set rr = New ADODB.Record
Set s = New ADODB.Stream
url = "url=" & url
c.Open url
r.ActiveConnection = c
r.Open
rr.ActiveConnection = c
Set rs = r.GetChildren
With rs
Do While Not .EOF
r.CopyRecord rs.Fields(0).Value, destination &
rs.Fields(0).Value
rr.Open rs.Fields(0).Value
With s
.Open rr, adModeRead, adOpenStreamFromRecord
.Charset = "ascii"
.Type = adTypeText
Debug.Print .ReadText
.Close
End With
rr.Close
.MoveNext
Loop
End With
r.Close
c.Close
End Sub
Sub TestGetRemoteFiles()
GetRemoteFiles "http://www.ffdba.com/downloads/", "c:/temp/"
End Sub
tranky wrote:
Hi, i'm italian...excuse me for my bad english.
I've a problem.
I need to download the code of a web page, but the translation of many
character is invalid.
An example is "à" wich is translate in "?", ecc...., or is become a square!!
I need to import it from the web page but in the right character!
I work connected to internet and with access 2003.
The code i've used is the follow:
Dim oHttp As Object
Dim txtRequestString, stringa2 As String
Set oHttp = CreateObject("MSXML2.XMLHTTP")
txtRequestString = www
oHttp.Open "GET", txtRequestString, False
oHttp.Send
txtHTML = oHttp.responsetext
in txtHTML i've the code downloaded from the page but it is made of pipe
(||||) or ?? or square. I need, instead, that the code was downloading
normally.
Excuse me for the english....in Italy, english's teachers are very bad....
:)
thank you
ps: (i can also change object to use if you find a different solution)