Bad file name or number

IMO

Now Known as ___
Local time
Today, 02:55
Joined
Sep 11, 2002
Messages
723
Hi All,

Can anyone tell me why I'm getting the error 'Bad File Name or Number' when using FileCopy??

Private Sub Command1_Click()
Dim strSource As String
Dim strDestination As String
strSource = "C:\IMPORTCSV\*.csv"
strDestination = "C:\HISTORYCSV"
FileCopy strSource, strDestination
End Sub

Thanks
IMO
 
Never done that myself but I'll hazard a guess.

In the line:

strSource = "C:\IMPORTCSV\*.csv"

You define the file as being called *.csv

As this is in a string, I don't believe the asterisk's wildcard property will come into play.
 
Thanks for your quick reply.

I tried naming the file rather than using the asterix but then got the error 'Path/File access error'. The problem I have is, on a daily basis I need to import about 30 .csv files (this is not a problem) move or copy the original files to a History Directory and then kill the files from the Import Directory (Killing the files is also not a problem). Do you or does anyone have any code examples of FileSystemObject MoveFile?

Thanks in advance
IMO
 

Users who are viewing this thread

Back
Top Bottom