Possible to always display full file path in title bar (Excel 2010)?

Special K

Board Regular
Joined
Jun 20, 2011
Messages
83
Office Version
  1. 2010
Platform
  1. Windows
I am using Excel 2010 and the base filename is displayed in the window title bar. Is it possible to have the full path displayed without having to save every workbook as .xlsm (i.e. macro-enabled workbook)? I've found a couple possible solutions to my question online but they all involve macros. Doesn't that mean I will need to save all of my Excel workbooks as macro-enabled (i.e. xlsm) in order to use these solutions?
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Is it possible to have the full path displayed without having to save every workbook as .xlsm (i.e. macro-enabled workbook)?
Yes.
VBA Code:
ActiveWindow.Caption = ActiveWorkbook.FullName
 
Upvote 0
Yes.
VBA Code:
ActiveWindow.Caption = ActiveWorkbook.FullName

How do I have this code automatically execute every time Excel opens (i.e. not be associated with any particular workbook)?
 
Upvote 0
How do I have this code automatically execute every time Excel opens (i.e. not be associated with any particular workbook)?
Paste to your ThisWorkbook module of Personal.xlsb:
VBA Code:
Option Explicit

Private WithEvents xlsApp  As Application

Private Sub Workbook_Open()
    Set xlsApp = ThisWorkbook.Application
End Sub

Private Sub xlsApp_WorkbookOpen(ByVal Wb As Workbook)
    ActiveWindow.Caption = Wb.FullName
End Sub
 
Last edited:
Upvote 0
Solution
Paste to your ThisWorkbook module of Personal.xlsb:
VBA Code:
Option Explicit

Private WithEvents xlsApp  As Application

Private Sub Workbook_Open()
    Set xlsApp = ThisWorkbook.Application
End Sub

Private Sub xlsApp_WorkbookOpen(ByVal Wb As Workbook)
    ActiveWindow.Caption = Wb.FullName
End Sub

Should this code also work with Excel 2013? I pasted it into the ThisWorkbook module of personal.xlsb on a different computer running Excel 2013, but then when I open Excel on that computer, I get the following error:

Code:
Run-time error '91':

Object variable or With block variable not set

The debugger highlights the ActiveWindow.Caption = Wb.FullName line.
 
Upvote 0
I can't access Excel 2013 now, but try add Set to this string:
Set ActiveWindow.Caption = Wb.FullName
 
Upvote 0
I can't access Excel 2013 now, but try add Set to this string:
Set ActiveWindow.Caption = Wb.FullName

It gives the same error. Do Excel 2010 and 2013 not follow the same VBA syntax rules?
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top