How do I get the title bar in Microsoft Word 2010 to show the full path of a fil
ID: 3560386 • Letter: H
Question
How do I get the title bar in Microsoft Word 2010 to show the full path of a file being worked on as it did in Word 97? This aspect is critical as I have to jump between files and directories. (Word 2010 wastes precious space (my screen is 5" in height) with brandishing in the title bar: Microsoft Word non-commercial use. This titling is utterly unnecessary because I know what I purchased which was the Home edition and for those using a machine unfamiliar to them the version is easily verified in usual channels.)
Explanation / Answer
Sub AutoOpen()
'********************
On Error Resume Next 'this section is optional
With ActiveWindow.View
If Err.Number = 4248 Then Exit Sub
.Type = wdPrintView
.Zoom = 100
.TableGridlines = True
End With
ActiveWindow.ActivePane.View.ShowAll = False
ActiveWindow.ActivePane.View.ShowFieldCodes = False 'to here
'*************
InsertDocTitle
End Sub
Sub InsertDocTitle()
' Changes window title to include path with filename
Dim NameArray As Variant
Dim NameStringL As String
Dim NameStringR As String
Dim Count As Long
Const maxLen = 120 ' set this value to fit your window width
' (avoid error if no active window)
If Windows.Count > 0 Then
NameStringL = ActiveDocument.FullName
If Len(NameStringL) > maxLen Then
' separate the folder names
NameArray = Split(NameStringL, "")
' check the folder depth
Count = UBound(NameArray)
If Count > 3 Then
NameStringL = NameArray(0) & "..."
NameStringR = NameArray(Count)
Count = Count - 1
' continue adding folders to the left of the string
' until you run out of folders or one won't fit
Do While (Count > 0) And _
(Len(NameStringL) + Len(NameStringR) + _
Len(NameArray(Count)) < maxLen)
NameStringR = NameArray(Count) & "" _
& NameStringR
Count = Count - 1
Loop
NameStringL = NameStringL & NameStringR
End If
End If
' Change the window's caption
ActiveWindow.Caption = NameStringL
End If
End Sub
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.