View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Return file name only from FileDialog

Most would strip out the filename from the fullpathName

sFileName =
Right(sFullPathName,Len(sFullPathBName)-InstrRev(sFullPathName,"\"))

demo'd from the immediate window:

sFullPathName = "C:\MyMainsubFolder\MySecondarySubFolder\Myfile.xl s"
? sFullPathname
C:\MyMainsubFolder\MySecondarySubFolder\Myfile.xls
sFileName =
Right(sFullPathName,Len(sFullPathName)-InstrRev(sFullPathName,"\"))
? sfileName
Myfile.xls

--
Regards,
Tom Ogilvy


"PMC1" wrote:

Hi,

I'm looking for a way to return only the File Name from the FileDialog
object. From what I can see I can only return both the full path and
file name.

I'm open to suggestion of alternative methods other than FileDialog
such as an API but again any API examples I have found only return the
full path.

Has anybody any suggestions on how i could do this?

Thanks

Paul