By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,457 Members | 1,301 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,457 IT Pros & Developers. It's quick & easy.

What is the stSCRFile code looking like

P: n/a
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

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 19 May 2005 04:51:44 -0700, "marlene" <ma******@comh.co.za> wrote:

Since you addressed this to me, I feel compelled to answer :-)

This code has two functions, a public one, and a private one. You're
only supposed to call the public one, named FTP.
The public function calls the private one, to do the work of FTP-ing a
file. That file has previously been created in the public function,
and it is located in <pathname>\__temp_script.tmp.
It contains instructions such as "lcd" and "open" that ftp.exe
understands. It also optionally sends a file to the other side.

There is a problem with this line:
Set Fs = CreateObject("Scripting.FileSy*stemObject")
Should be:
Set Fs = CreateObject("Scripting.FileSystemObject")

-Tom.
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


Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.