Archive of Mr Excel Message Board


Back to Excel VBA archive index
Back to archive home

File Path

Posted by Ray Deis on February 19, 2001 8:17 PM

Is there a way to display the full path of the current file in the Excel Window Title bar?

Check out our Excel VBA Resources

Re: File Path

Posted by Dave Hawley on February 19, 2001 8:47 PM

Ray, you will need to place this code in Workbook Module of your personal macro workbook.


Private Sub Workbook_Open()
Application.ActiveWindow.Caption = ActiveWorkbook.FullName
End Sub


To get to it Push Alt+F11 then Ctrl+R and in th "Project Explorer" double click "ThisWorkbook" in the "Personal.xls"


Dave

OzGrid Business Applications


Hide "Microsoft Excel"??

Posted by JAF on February 20, 2001 3:51 AM
Dave

The code supplied adds the full path.

Is there any way to stop it from prefixing this with "Microsoft Excel - " so that it diaplays the full path and nothing else??


Re: Hide "Microsoft Excel"??

Posted by Celia on February 20, 2001 4:09 AM
Dave The code supplied adds the full path. Is there any way to stop it from prefixing this with "Microsoft Excel - " so that it diaplays the full path and nothing else??


JAF
Here's one way :-
Application.Caption = " "
To get it back again :-
Application.Caption = ""
Celia


One last question.

Posted by JAF on February 20, 2001 7:02 AM
Celia

Thanks for the reply. I can now set the caption to display what I want with:
Sub Custom_Caption()
Application.Caption = "JAF"
Application.ActiveWindow.Caption = ActiveWorkbook.FullName
End Sub

However, when I reset it using the code:
Sub Default_Caption()
Application.Caption = ""
Application.ActiveWindow.Caption = ActiveWorkbook.Name
End Sub
the ActiveWorkbook.Name suffixes the filename with .xls (I have the 3 letter extensions hidden by default).

Is it possible to reset the caption to display the filename but without the 3 letter extension?

JAF

Dave The code supplied adds the full path. Is there any way to stop it from prefixing this with "Microsoft Excel - " so that it diaplays the full path and nothing else??


Re: One last question.

Posted by Celia on February 20, 2001 3:16 PM
Celia Thanks for the reply. I can now set the caption to display what I want with:


JAF
Try this :-

Sub Default_Caption()
Application.Caption = ""
Application.ActiveWindow.Caption = Application.Substitute(ActiveWorkbook.Name, ".xls", "")
End Sub

Celia


Re: File Path

Posted by Ray Deis on February 20, 2001 7:37 PM

Thanks Dave. Now that it works for one document is there a way to have the full path automatically appear for every file that is opened without having to add the code to every workbook


This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.