#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default ftp --- VBA

Hello everyone,

Is it possible to ftp to a location and
prompt the user for the remote file
and where to save the file locally?
(text transfer).

Thanks in advance.

--
Himansu


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default ftp --- VBA

First step:

create and test a script to ftp a file:

open mydomain.com
user myusername mypassword
binary
cd /tmp
put C:/myfilethatiwant2ftp.txt
quit
EOF

Replace variables having names my* with your counterparts.
Save file. Give it a .scr suffix. Example

C:/mydoftp.scr

Execute the following command to test mydoftp.scr

c:\windows\system32\ftp.exe -n -s:mydoftp.scr

Step 2:

Use Excel VBA to create mydoftp.scr

Sub WriteStr(str As String, basename As String)
Dim DoWrite As Boolean
Dim DoBreak As String
DoWrite = True
If DoWrite Then
Open "C:\mydoftp.scr" For Output As #1
Print #1, str
Close #1
End If
DoBreak = ""
End Sub

The variable str should be a string consisting of the revised test
script.

Google this newsgroup about how to execute a shell command from Excel.
Make it so that Excel calls c:\windows\system32\ftp.exe -n
-s:mydoftp.scr

Hello everyone,

Is it possible to ftp to a location and
prompt the user for the remote file
and where to save the file locally?
(text transfer).

Thanks in advance.

--
Himansu


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



All times are GMT +1. The time now is 03:04 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"