Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i save file to show current worksheet Hatleydell Excel Discussion (Misc queries) 2 November 24th 08 10:07 AM
Save current sheet to new file Danno 24/7[_2_] Excel Discussion (Misc queries) 1 May 8th 08 04:32 PM
is it possible to disable "save" prompt in excel file on web server? [email protected] Excel Discussion (Misc queries) 0 May 9th 07 05:58 PM
Script to save Excel file to the server. raj41977 Excel Discussion (Misc queries) 3 December 8th 05 02:48 PM
Save file to Web Server from Workbook on Web Page Abe[_3_] Excel Programming 0 November 9th 03 10:45 PM


All times are GMT +1. The time now is 01:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"