Coding in an FTP password.....


Active Member
May 3, 2002
Ok... this one's been eluding me, and I cannot seem to find anything on the board that answers my question.

Here's the scenario: I'm importing a .csv file from a UNIX server and putting it into an existing file. The UNIX server requires a password to log on to it, so the 'FTP Log On' window pops up. It gives an option of 'Anonymous' or 'User', then has a space for a password.

Problem: I need to be able to write into my code both my username and password, so that other people without Password access to the UNIX server can update the book while I'm away.

Please Help!!

Thanks in advance, fellow Excelites :)
- Thomas

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
You can use the sendkeys command or make a winsock connection to the FTP server? ;p Just a couple of ideas.
Upvote 0
Wow... ok. I think you lost me on that one. Sorry, I've never used either before; can you expound on that?
Upvote 0

Are you using a batch file, called from a macro, to get your file?. I do sommething similar. The code in the macro is

Call Shell("c:myfile.bat", vbNormalFocus)

the myfile.bat contains the following

ftp -s:getfile.dat

getfile.dat is in the targetdir directory and has the following ftp commands

open (Unix address)
cd /Unix/Directory
get filename


Upvote 0
Windows 2000: you can add an ftp location (complete with user name and password) in your "my network places" folder. This location can then be opened from excel because the File > Open box includes the "my network places list"

For other op. systems there is a similar list of FTP locations.

Also see excel help: search for "add FTP location".
Upvote 0
Nicely done RichardS!

Check out a program called wcl_ftp. It's a command line driven Windows FTP client. You could really make this process look slick with it because it can be run silent and no command shell flashes. When run normally, it appears as a dialog box and reports on the status of the transfer. It also has logging options and some other cool stuff. I use it all the time and it's been reliable and slick.
Upvote 0
XP doesn't store the password (in it's network places definition) so it wouldn't work for unattended jobs but it works perfectly otherwise.

I'll be telling everybody about this trick at work tomorrow.
Upvote 0
Here's the code I'm using to do this:

Sub GetData()

Workbooks.Open Filename:= _
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Workbooks("Trouble Window List").Activate
Application.CutCopyMode = False
Workbooks("Trouble Window List").Activate


End Sub

The point at which the program makes a call to the FTP location is where it is asking for a User ID and Password. I attempted this on another user's computer, and it auto-selected 'Anonymous' for user, and (obviously) left the password space blank. Since the 'User' information is in a separate frame from the Password entry text box, I really am lost on attacking this.

Again, thanks for the input thus far; I'll keep checking back.

Thanks again;
- Thomas
Upvote 0
Sorry... just reviving this a bit in hopes that someone out there can help out... :)

I know the truth is out there :wink:

- Thomas
Upvote 0

Forum statistics

Latest member

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back