View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default 52 Bad file name or number - when reading file from FTP

you should talk to your systems people about this. You can quite easily map a
network drive letter to an FTP address. This would be seamless to Excel &
your file's address would be just liek any other, eg "H:\..." where H would
be mappe dto the FTP address. We have several such as our counterparts send
data to us via FTP and we consume tha data via sevaral applications,
including excel.

"Olle" wrote:

Hi,
My application gets a filename (normally located on the users local drive
(C:\Test\RU012005003.TXT)), opens it and read it. This works without errors.

The User has now moved the file to a FTP site
(ftp://ftp.volvo.se/tovolvo/bengto/RU012005003.TXT) and receives the message:
52 Bad file name or number.
I have traced the code and it stops at: Open bcs_file For Input ....
This is the code:
bcs_file = Application.GetOpenFilename("Text Files (*.txt), *.txt,CSV Files
(*.csv), *.csv,All Files (*.*), *.*", , "Get Flatfile")

If bcs_file = False Then
MsgBox "No file were chosen - the function ends... ", vbExclamation +
vbOKOnly, "Oppps..."
Exit Sub
End If

fileno = FreeFile()
Open bcs_file For Input Access Read As #fileno

Can anyone help me, please.
Regards...Olle