View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_129_] joel[_129_] is offline
external usenet poster
 
Posts: 1
Default HELP: saving a file with specific name


this is the line that is performing the copy

FileCopy varFile, strDestFolder & _
Mid(varFile, InStrRev(varFile, Application.PathSeparator))

Varfile : Is the complete path name of the file to be copied

strDestFolder : Is the destination Folder


This line below removes the filename from path name
Mid(varFile, InStrRev(varFile, Application.PathSeparator))


for example
from
c:\temp\abc.pdf
to
abc.pdf

the code is looking for the last backslash using INSTRREV and taking
everything after the last back slash

So you would need to do this

from
FileCopy varFile, strDestFolder & _
Mid(varFile, InStrRev(varFile, Application.PathSeparator))


to
NewfileName = "abc.pdf"
FileCopy varFile, strDestFolder & NewFileName


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=149299