View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Get filename only

Hi
try the following (will not work in Excel 97 due to InStrRev)
sub foo()
dim fname
fname = application.getopenfilename (FileFilter:="All files (*.*),
*.*", _
Title:="Select a file", MultiSelect:=False)
fname = mid(fname,instrrev(fname,"\")+1,255)
msgbox "You have entered the name:" & fname
end sub

--
Regards
Frank Kabel
Frankfurt, Germany

"kaon " schrieb im Newsbeitrag
...
Dear all,

How can I just return the filename only (i.e without path) as an
absolute path can be returned by:
fName = Application.GetOpenFilename(FileFilter:="All files (*.*),
*.*", _
Title:="Select a file",
MultiSelect:=False)

Thanks.


---
Message posted from http://www.ExcelForum.com/