Results 1 to 7 of 7
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Word document title (W97 and W2K)

    Is there a way to make list the entire path as well as the name of a document in the title bar? Along the lines of how you can choose to display it in windows explorer ...

    I ask because I have to deal with multiple copies of templates for our users and it's all too easy to get confused as to which directory's copy of a particular template you're looking at - and since there's all that lovely space across the title bar not being used it would be nice ...

    Many thanks in advance for any help <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Beryl M


  2. #2
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Warrington, Cheshire
    Posts
    355
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Word document title (W97 and W2K)

    Beryl,
    Open the document in question and select Alt+F11
    On the left of the VBE (visual basic editor) window you should see the project explorer window (if not, select Ctrl+R)
    In this window select This document and press F7
    In the code window on the right (maximise if necessary) select Document (under General) and Open from the right selection box.(when you first select general it may put you in the New-document sub-procedure)
    Add the following code as necessary:

    Private Sub Document_Open()
    Application.Caption = Application.Path & " " & ActiveDocument.Name
    End Sub

    The existing limits of Private Sub Document_Open() and End Sub should already have appeared.
    Save the document and next time it opens you should have the path and filename in the title bar.
    (Although it does flag up macro warning each time you open the doc)
    Hope this helps.
    Regards
    Alan
    UK
    Cheshire

  3. #3
    BAM
    Guest

    Re: Word document title (W97 and W2K)

    Hi Beryl,

    First, just to correct a slight error in the code Alan provided <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    This code will provide path for the location of Winword.exe followed by the file name instead of the location of the file. Also, if you use Application. Caption. The title bar may not update correctly.

    For example, if you use Application.Caption, if you close the file the title bar will not update. Same goes if you create a new document. It will display the path of the previous document that was opened.

    It should be:

    ActiveDocument.ActiveWindow.Caption = ActiveDocument.FullName

    Now, if you are also supporting Word 97 users then this could be a problem. You might want to reference this article for more information:
    <A target="_blank" HREF=http://support.microsoft.com/support/kb/articles/Q155/9/91.asp>http://support.microsoft.com/support/kb/ar...s/Q155/9/91.asp</A>

    Second, I have found this to be a 'tricky' setting to control. You can add the path to the title bar using the VBA, however it can be fallible and you must accommodate many possibilities if developing for users.

    The Document_Open event will only fire when a file based on the template is opened. Ideally these macros need only be created once and stored in a Global template so they don't need to be created for each template. So in this scenario, the Document_Open event will not file. You would need to use an AutoOpen macro instead. You can not use FileOpen because when you open a file from the MRU under File, it does not use the FileOpen event.

    Also, for it to work seamlessly, you need to intercept the FileSaveAs and FileSave events, and for the FileSaveAs command, you need to add an error handling routine such as On Error Resume Next to accommodate the error that occurs if the Cancel button is clicked. (I believe there are a few other gotchas as well. If you really want them I can provide them to you. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>)

    Now to throw another 'tidbit' in this scenario, if you have a global template or add-in that also contains a FileSaveAs command, it can intercept your FileSaveAs macro and the title bar will not update. You never know when this could occur. Many 3rd parties create global templates/add-ins/COM add-ins to provide additional functionality to Word without you realizing it.

    The repercussions of this are: The title bar may still reflect the previous file name.

    This is the problem I ran into and decided forgo macros. I thought I was working on specific document (according to the title bar) when in fact I was working on another and made many modifications to the file and updated it. This resulted in the loss of some valuable information. <img src=/S/frown.gif border=0 alt=frown width=15 height=15>

    So... what you can use that will never fail is the Address bar in the Web toolbar. This requires no macros and I have found it to be dependable 100% of the time. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    What I do is add the Address bar to the empty area of my menu bar:

    - Right-click any toolbar and turn on the Web toolbar.
    - Press <Ctrl Alt> and drag the Address bar to an empty area of your menu bar.

    Should you want to resize it and make it larger so it fills the extra space:
    - Right-click any toolbar and select Customize
    - Select the Address bar
    - Place your mouse on the right side and you should see the sizing pointer
    - Click and hold and drag to the desired width

    If this change is made in the template, when you open a document based on the template the address bar will automatically appear and reflect the full path and document name.
    ~~~~~~~~~~~~~~
    Cheers! <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>

  4. #4
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Warrington, Cheshire
    Posts
    355
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Word document title (W97 and W2K)

    OK, I error'd <img src=/S/bash.gif border=0 alt=bash width=35 height=39>.
    Sorry Beryl, and much thanks for pointing out error in subsequent post.
    OK, so instead of placing the path and filename in the title bar, (and risk not having it work for activewindow), why not include path as part of the header and change font to hidden? Unless the user has hidden text to print such as in track changes then you'll have the path at the top of each page.
    Just a thought.
    Alan

    p.s. Is it me, or is Word one of the best strategy games you've played as well?

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Word document title (W97 and W2K)

    Thanks to both of you - I have used a combination of both your suggestions (along with some from another thread) and AutoNew, AutoOpen, AutoSave and AutoClose macros and it all seems to work!

    Incidentally, I had found the web address bar, but I didn't know how to resize it and since some of my paths are pretty long, when it put the ... in to indicate other directories it always seemed to do it at the directory level I needed to refer to! So many thanks for the note on resizing that, too!

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Beryl M


  6. #6
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Warrington, Cheshire
    Posts
    355
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Word document title (W97 and W2K)

    Beryl,
    final word(?), I correct my original post with:

    activedocument.fullname

    to show path and filename of the actual document and not the application program
    Alan
    UK
    Cheshire

  7. #7
    BAM
    Guest

    Re: Word document title (W97 and W2K)

    Hi Alan,

    No need to beat yourself up over any of this! <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>

    We're all here to learn more about "How to conquer Word" and the best way to learn is from each other. I take away something new everything day from these boards! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    ~~~~~~~~~~~~~~
    Cheers! <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •