Recently we've had some posts about ftp. I wrote my own ftp class a few
years ago and it works satisfactorily for me.
Today for a simple writing of text or binary to a file on a server I use
ADO rather than FTP (I'm using 2.8 and am not sure when this capability
occurred).
This creates or overwrites a file on my server. Then it writes some text to
that file.
A little investigation would allow one to modify this to transfer a file,
and/or to change the direction of transfer.
Sub temp()
Dim r As ADODB.Record
Dim s As ADODB.Stream
Set r = New ADODB.Record
Set s = New ADODB.Stream
' open the file for writing
' over write if it exists
' else create it
r.Open "http://www.ffdba.com/temporary.txt", , adModeWrite,
adCreateOverwrite
' windows xp asks for username and password here
' but will "remember" them if prompted
' (you can include them in your code, of course)
With s
' open a stream
' associated with the record
.Open r, , adOpenStreamFromRecord
' write some text
.WriteText "This is a test!"
.Close
End With
r.Close
End Sub
On http://www.ffdba.com a file called temporary.txt appears and its
contents are "This is a test!".
MS examples show setting r and s to nothing. I know of no reason to set
anything except DAO objects to nothing, but maybe you would like to do
this.
--
Lyle
--