Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default current toolbar file path?

i would like to display in a msgbox the current toolbar file path (similar to
how the following displays the current workbook's path: MsgBox
ThisWorkbook.FullName). is this possible?

[note: if the answer is to perform a file search & then use the results in a
msgbox, i have trouble getting file search to consistently work. today it
won't display any results for a *.xlb search, yet previously it led me to
where my file was saved. i never know if "no results" really means no
results. i'm sure it's me, but i haven't figured it out.]

thank you.
elizabeth
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default current toolbar file path?

I don't know any built-in method to return the xlb path in excel macro.
if using Excel 2000 and later, how about something like this:

Function XLBPath() 'for Excel 2000 and later
Dim XLBName As String, XLStart As String
Dim nVer As Integer, i As Integer
nVer = Int(Val(Application.Version))
Select Case nVer
Case Is < 9: Exit Function
Case 9: XLBName = "Excel.xlb"
Case Else: XLBName = "Excel" & nVer & ".xlb"
End Select
XLStart = Application.StartupPath
i = InStrRev(XLStart, "\")
If i 0 Then XLBPath = Left(XLStart, i) & XLBName
End Function

--
HTH,

okaizawa


Elizabeth wrote:
i would like to display in a msgbox the current toolbar file path (similar to
how the following displays the current workbook's path: MsgBox
ThisWorkbook.FullName). is this possible?

[note: if the answer is to perform a file search & then use the results in a
msgbox, i have trouble getting file search to consistently work. today it
won't display any results for a *.xlb search, yet previously it led me to
where my file was saved. i never know if "no results" really means no
results. i'm sure it's me, but i haven't figured it out.]

thank you.
elizabeth

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default current toolbar file path?

Okaizawa:
THANK YOU!
I added "MsgBox XLBPath" at the end of your function & it displayed exactly
where my Excel11.xlb file is located. I was not able to get .FileSearch or
Dir() to do this. Yea! As long as my Excel 2003 users do not change their
toolbar file name from the default name, this will do the trick (& I'm not
sure if Excel would allow them to change the default name). Because I am new
to VBA, I found functions within your code that are new to me & will be
useful for other purposes (e.g., Val & InStrRev). What a bonus! Thank you
so much for taking the time to help me.
Elizabeth


"okaizawa" wrote:

I don't know any built-in method to return the xlb path in excel macro.
if using Excel 2000 and later, how about something like this:

Function XLBPath() 'for Excel 2000 and later
Dim XLBName As String, XLStart As String
Dim nVer As Integer, i As Integer
nVer = Int(Val(Application.Version))
Select Case nVer
Case Is < 9: Exit Function
Case 9: XLBName = "Excel.xlb"
Case Else: XLBName = "Excel" & nVer & ".xlb"
End Select
XLStart = Application.StartupPath
i = InStrRev(XLStart, "\")
If i 0 Then XLBPath = Left(XLStart, i) & XLBName
End Function

--
HTH,

okaizawa


Elizabeth wrote:
i would like to display in a msgbox the current toolbar file path (similar to
how the following displays the current workbook's path: MsgBox
ThisWorkbook.FullName). is this possible?

[note: if the answer is to perform a file search & then use the results in a
msgbox, i have trouble getting file search to consistently work. today it
won't display any results for a *.xlb search, yet previously it led me to
where my file was saved. i never know if "no results" really means no
results. i'm sure it's me, but i haven't figured it out.]

thank you.
elizabeth


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
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
Current Workbook Path windsurferLA Excel Programming 1 February 19th 05 04:19 PM
Current Workbook Path MarkTheNuke Excel Programming 0 February 19th 05 06:31 AM
Current path to Qualified Path Mary Excel Programming 1 October 14th 04 02:42 PM
path to current file... daschund Excel Programming 1 August 31st 04 11:45 PM


All times are GMT +1. The time now is 02:34 PM.

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

About Us

"It's about Microsoft Excel"