Add the line
ActiveWindow.Caption = ActiveDocument.FullName
to an autoopen macro in the normal template to put the path in the Word
title bar.
http://www.gmayor.com/installing_macro.htm
OR
If you have long pathnames you may wish to abbreviate the path to fit the
title bar. The following macro will do that so replace the above suggested
line with
InsertDocTitle
You may wish to expand this ability and add the function to open the
document at the place the cursor was at when you last saved it. For that you
need some extra macros to intercept the save commands:
Sub FileSaveAs()
On Error Resume Next
ActiveDocument.Bookmarks.Add Range:=Selection.Range, name:="OpenAt"
Dialogs(wdDialogFileSaveAs).Show
'ActiveWindow.Caption = ActiveDocument.FullName
InsertDocTitle
End Sub
Sub FileSave()
On Error Resume Next
ActiveDocument.Bookmarks.Add Range:=Selection.Range, name:="OpenAt"
ActiveDocument.Save
'ActiveWindow.Caption = ActiveDocument.FullName
InsertDocTitle
End Sub
and a further addition to the autoopen macro
Sub AutoOpen()
'This section is optional
'********************
With ActiveWindow.View
.Type = wdPrintView
.TableGridlines = True
End With
ActiveWindow.ActivePane.View.ShowAll = False
'********************
If ActiveDocument.Bookmarks.Exists("OpenAt") = True Then
ActiveDocument.Bookmarks("OpenAt").Select
End If
'ActiveWindow.Caption = ActiveDocument.FullName
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
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>