Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Extracting Workbook name

I have a workbook which has a list of path and filenames for workbooks.
I want to extract from each of these the workbook name only.
e.g From this path I want to extract only the name "Lucky Draw.xls"

C:\Documents and Settings\Bbrian\My Documents\My Documents\Brian
docs\Clay\Clay WorkBooks\Workbooks\Lucky Draw.xls

Each of the path names are vaiable lengths and a variable number of sub
direcotries

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Extracting Workbook name


Ron Rosenfeld seems to have offered the solution to my problem. Thanks
to all who replied

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Extracting Workbook name

On 2 Oct 2006 07:58:58 -0700, wrote:


Ron Rosenfeld seems to have offered the solution to my problem. Thanks
to all who replied


You're welcome. Glad to help. Thanks for the feedback.
--ron


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7
Default Extracting Workbook name


wrote:
I have a workbook which has a list of path and filenames for workbooks.
I want to extract from each of these the workbook name only.
e.g From this path I want to extract only the name "Lucky Draw.xls"

C:\Documents and Settings\Bbrian\My Documents\My Documents\Brian
docs\Clay\Clay WorkBooks\Workbooks\Lucky Draw.xls

Each of the path names are vaiable lengths and a variable number of sub
direcotries


Hi Brian,
You can create a user defined function to achieve this. I found this
one he
http://www.ozgrid.com/VBA/GetExcelFileNameFromPath.htm

Function FunctionGetFileName(FullPath As String)
Dim iCount As Integer
Dim StrFind As String
Do Until Left(StrFind, 1) = "\"
iCount = iCount + 1
StrFind = Right(FullPath, iCount)
If iCount = Len(FullPath) Then Exit Do
Loop
FunctionGetFileName = Right(StrFind, Len(StrFind) - 1)
End Function

Best Regards,

CalumMurdo Kennedy

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,393
Default Extracting Workbook name

Here is a User Defined Function that does it
Function FindName(mytext)
x = Len(mytext)
temp = ""
For j = x To 1 Step -1
myletter = Mid(mytext, j, 1)
If myletter < "\" Then
temp = myletter & temp
Else
Exit For
End If
Next j
FindName = temp
End Function

Need help with VBA? See David McRitchie's site on "getting started" with VBA

http://www.mvps.org/dmcritchie/excel/getstarted.htm

best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

wrote in message
oups.com...
I have a workbook which has a list of path and filenames for workbooks.
I want to extract from each of these the workbook name only.
e.g From this path I want to extract only the name "Lucky Draw.xls"

C:\Documents and Settings\Bbrian\My Documents\My Documents\Brian
docs\Clay\Clay WorkBooks\Workbooks\Lucky Draw.xls

Each of the path names are vaiable lengths and a variable number of sub
direcotries



Reply
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
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Extracting Data from one workbook to another jbobzien New Users to Excel 3 February 20th 06 07:47 PM
excel exits unexpectedly or hangs the second time I open workbook r_m_i Excel Discussion (Misc queries) 0 February 9th 06 10:14 PM
Repost:Automatically inserting a row in external workbook 50pingviner Excel Discussion (Misc queries) 3 December 28th 05 07:38 PM
How to hyperlink from a workbook to sheets in another workbook? MJOHNSON Excel Worksheet Functions 0 February 17th 05 08:31 PM


All times are GMT +1. The time now is 05:57 AM.

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"