ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   52 Bad file name or number - when reading file from FTP (https://www.excelbanter.com/excel-programming/330829-52-bad-file-name-number-when-reading-file-ftp.html)

Olle

52 Bad file name or number - when reading file from FTP
 
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

Patrick Molloy[_2_]

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



All times are GMT +1. The time now is 12:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com