Hi, I'm trying to come up with a way to FTP a file from mainframe into Access. So far I've got the below code. My question is how to I get the text file to land in C:\temp\ folder. Every time I execute this script the destination file always lands in some random folder. Below is the code I used.
Dim TextFile As Integer
Dim FilePath As String
'What is the file path and name for the new text file?
'ftpServer = "server"
'What is the file path and name for the new text file?
FilePath = "C:\temp"
'Determine the next file number available for use by the FileOpen function
TextFile = FreeFile
'Open the text file
Open FilePath & "trfr.txt" For Output As TextFile
'Write some lines of text
Print #TextFile, "open uhc1s1ip"
Print #TextFile, "username"
Print #TextFile, "password"
Print #TextFile, ""
Print #TextFile, "get 'T0003.CCT.M1702.CAMS.MEMBER.TAGIDX.BL01' MEMBER_DEMOGRAPHIC_BL.TXT"
Print #TextFile, ""
Print #TextFile, "close"
Print #TextFile, "bye"
'Save & Close Text File
Close TextFile
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%COMSPEC% /k FTP -i -s:" & "C:\temp\trfr.txt", 1, True
Dim TextFile As Integer
Dim FilePath As String
'What is the file path and name for the new text file?
'ftpServer = "server"
'What is the file path and name for the new text file?
FilePath = "C:\temp"
'Determine the next file number available for use by the FileOpen function
TextFile = FreeFile
'Open the text file
Open FilePath & "trfr.txt" For Output As TextFile
'Write some lines of text
Print #TextFile, "open uhc1s1ip"
Print #TextFile, "username"
Print #TextFile, "password"
Print #TextFile, ""
Print #TextFile, "get 'T0003.CCT.M1702.CAMS.MEMBER.TAGIDX.BL01' MEMBER_DEMOGRAPHIC_BL.TXT"
Print #TextFile, ""
Print #TextFile, "close"
Print #TextFile, "bye"
'Save & Close Text File
Close TextFile
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%COMSPEC% /k FTP -i -s:" & "C:\temp\trfr.txt", 1, True