Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to save the Current Excel file to FTP server
Dear Expert,
How to save the Current Excel file to FTP server (must use VBA Coding) I have tried many ways but it seem cannot work through..... Tried #1 .... ActiveWorkbook.SaveAs /Reports/" & FileName Error Message come out Tried #2 .... Open FilePath & "ftp.bat" For Output As #1 Print #1, "open " & "61.38.xxx.xxx" Print #1, "username" Print #1, "password" Print #1, "put" Print #1, """" & FileNameSaved & """" Print #1, "/Reports/" & FileName Print #1, "close" Print #1, "quit" Close #1 RetVal = Shell("ftp.exe -s:""" & FilePath & "ftp.bat""", vbHide) Error Message come out too, and do not know when is finish upload process Tried #3 .... I used "wininet.dll" via API Dim hConnection As Long, hOpen As Long, sOrgPath As String '// open an internet connection hOpen = InternetOpen("Upload Excel To Ftp", _ &H0, _ vbNullString, _ vbNullString, _ 0) '// connect to the FTP server hConnection = InternetConnect(hOpen, _ "61.38.xxx.xxx", _ 21, _ "username", _ "password", _ 1, _ 0, _ 0) '// set the current directory to 'root/reports' Ret = FtpSetCurrentDirectory(hConnection, "Reports") '// upload the file Ret = FtpPutFile(hConnection, FileNameSaved, FileName, &H0, 0) '// close the FTP connection InternetCloseHandle hConnection '// close the internet connection InternetCloseHandle hOpen Error on the major instruction, i.e. "Ret = FtpPutFile(hConnection, FileNameSaved, FileName, &H0, 0)" Cannot Try #4 .... I heard, can use an ActiveX control (Inet.ocx), but I cannot find it on the VBA project reference, even the userform control add also cannot find this component. Appreciate on advise Patrick |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do i save file to show current worksheet | Excel Discussion (Misc queries) | |||
Save current sheet to new file | Excel Discussion (Misc queries) | |||
is it possible to disable "save" prompt in excel file on web server? | Excel Discussion (Misc queries) | |||
Script to save Excel file to the server. | Excel Discussion (Misc queries) | |||
Save file to Web Server from Workbook on Web Page | Excel Programming |