LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default just file name no path

Just thought I'd say thanks for this too. I've been looking all
morning for this!

Thanks :)



Dave Peterson wrote:

Just to add to Tom's response, I'd loop backwards.

dim iCtr as long
dim filetoopen as variant
dim JustFileName as string

fileToOpen = Application.GetOpenFilename("DBF Files (*.dbf), *.dbf")

if filetoopen = false then
exit sub
end if

for ictr = len(filetoopen) to 1 step -1
if mid(filetoopen, ictr, 1) = Application.PathSeparator then
justfilename = mid(filetoopen, ictr + 1)
exit for
end if
next ictr



Charles Chickering wrote:

What if they are using a cursed Mac? <gr

--
Charles Chickering

"A good example is twice the value of good advice."

"Dave Peterson" wrote:

If you're using xl2k or higher, you could use instrrev() to find the last \.

dim filetoopen as variant
dim JustFileName as string
fileToOpen = Application.GetOpenFilename("DBF Files (*.dbf), *.dbf")
if filetoopen = false then
exit sub
end if
justfilename = mid(filetoopen,instrrev(filetoopen,"\")+1)





"musa.biralo" wrote:

Hi
is there a way to get the file name only? Using this
fileToOpen = Application.GetOpenFilename("DBF Files (*.dbf), *.dbf")

i got complete path. i want the path as well as file name. So, for
path this is ok to me but not for the file name. Please help me or
direct me to the right place.

musa.biralo

--

Dave Peterson


--

Dave Peterson


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
File Path Too Long? Not Anymore! Check out Long Path Tool Max Loger Excel Discussion (Misc queries) 1 March 24th 17 07:59 AM
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo Max Loger Excel Discussion (Misc queries) 0 June 14th 11 04:30 PM
Formula too long - new file path is shorter than old file path - Excel 2003 Greg J Excel Worksheet Functions 1 November 22nd 06 05:16 PM
How set file open path to filepath of file opened with Explorer ? RandyDtg1 Excel Programming 0 May 14th 04 02:05 AM
get path - save new file - same sub-directory as existing file tegger Excel Programming 2 October 21st 03 10:45 AM


All times are GMT +1. The time now is 04:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"