You should probably include some handling in case there's no jpg files left
in the folder (or maybe jpegs as well? they're not the same for programming
purposes).
SourceFile = Dir("C:\Test\*.jpg")
If Len(SourceFile) <> 0 Then
DestinationFile = "C:\somefile.jpg"
FileCopy, SourceFile, DestinationFile
End If
End Function
--
Jack Leach
www.tristatemachine.com
"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
"IT-1957" wrote:
> I tried this code which a tink is more accurate but still doesn't work.
>
> Function Test()
>
> Dim SourceFile, DestinationFile
> SourceFile = Dir("C:\PICTURES\*.jpg")
> DestinationFile = ("C:\DATABASE\TEST.jpg")
>
> FileCopy SourceFile, DestinationFile
>
> End Function
>
> --
> IT1957
>
>
> "IT-1957" wrote:
>
> > Hi,
> > I'm trying to move a file witha variable name to a different folder but a
> > get a File not Found Error, Can you help me with this?
> > This is the code I'm trying to use:
> >
> > Function Test()
> >
> > Dim SourceFile, DestinationFile, MyFile
> > MyFile = Dir("C:\PICTURE\*.jpg")
> > SourceFile = "C:\PICTURES\MyFile"
> > DestinationFile = "C:\Database\Test.jpg"
> > FileCopy SourceFile, DestinationFile
> >
> > End Function
> >
> > Any Help will be really appreciate it.
> >
> > Thank you.
> >
> > --
> > IT1957