Copying file, changing filename and saving with original extension

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.
 
D

Douglas J. Steele

Wouldn't you just need to keep the file extension for that?

FileExtension = Mid([FullPathToFile], InStrRev([FullPathToFile], ".") + 1)
 
R

RussCRM

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?
 
D

Douglas J. Steele

How about you post the code you're currently using, rather than me having to
make it all up?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top