Copying file, changing filename and saving with original extension

  • Thread starter Thread starter RussCRM
  • Start date Start date
R

RussCRM

Anyone know how to rename a file, but with the original extension?

For instance,

FileCopy (C:\ImageName.jpg, \\Server\Images\Image_GuestID.jpg)

I was assigning a file name using something like "\\Server\Images" &
"_" & [GuestID] & .dib but then when I added the ability to link to
jpg's, (which are then copied to the Server file as above) I realized
this wasn't going to work. So, I'm looking for something that will
get the type of file that the original was and rename it as the same
type of file.
 
Wouldn't you just need to keep the file extension for that?

FileExtension = Mid([FullPathToFile], InStrRev([FullPathToFile], ".") + 1)
 
Looks good, but I'm kind of an amateur... could you possibly show me
what that would look like for the above? Would I use that as a
variable and add it to the end of my filename string?
 
How about you post the code you're currently using, rather than me having to
make it all up?
 
Back
Top