Dear Tom
With this code:
Public Function FTP(ascii As Boolean, send As Boolean, pathname As
String, FileName As String, server As String, serverpathname As String,
serverfilename As String, username As String, password As String,
Optional RstN As String, Optional RstFld As String)
Dim Fs As Object
Dim a As Variant
Dim RST As Recordset
Const script = "__temp_script.tmp"
'---
Dim asciiType As String
If ascii = True Then asciiType = "ascii" Else asciiType = "binary"
'---
Dim SendType As String
If send = True Then SendType = "Put " Else SendType = "Get "
'---create and open the file
Set Fs = CreateObject("Scripting.FileSy*stemObject")
Set a = Fs.CreateTextFile(pathname & "\" & script, True)
' write all the lines to the file
a.WriteLine "lcd " & Chr(34) & pathname & Chr(34)
a.WriteLine "open " & server
a.WriteLine username
a.WriteLine password
If (serverpathname <> "") Then a.WriteLine "cd " & serverpathname
If (ascii) Then
a.WriteLine asciiType
Else
a.WriteLine asciiType
End If
If RstN <> "" Then
Set RST = CurrentDb.OpenRecordset(RstN)
Do While Not RST.EOF
FileName = RST.Fields(RstFld) & ".html"
serverfilename = FileName
a.WriteLine SendType & FileName & " " & serverfilename
RST.MoveNext
Loop
Else
a.WriteLine SendType & FileName & " " & serverfilename
End If
a.WriteLine "bye"
'close file
a.Close
sFTP (pathname & "\" & script)
End Function
Private Sub sFTP(stSCRFile As String)
Dim stSysDir As String
'---
stSysDir = Environ$("COMSPEC")
stSysDir = Left$(stSysDir, Len(stSysDir) - Len(Dir(stSysDir)))
Call Shell(stSysDir & "ftp.exe -s:" & stSCRFile, vbNormalFocus)
End Sub
What does the stSCRFIle code look like? I mean what do you put inside
that file?
Thanks Marlene