Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Apr 2001
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Filename and Path field in macro (MS Word 2000)

    I made a macro that adds fields for the filename and path and the date in the footer of a document. When I run the macro, only the date field shows in the footer. If I close the file and re-open it, the filename appears in the footer. Here is the code (I didn't write the code, I just recorded the macro)

    Sub FileTag()
    '
    ' FileTag Macro
    ' Macro recorded 10/17/2001 by JBreneman
    '
    If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
    ActiveWindow.Panes(2).Close
    End If
    If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
    ActivePane.View.Type = wdOutlineView Then
    ActiveWindow.ActivePane.View.Type = wdPrintView
    End If
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    If Selection.HeaderFooter.IsHeader = True Then
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
    Else
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    End If
    NormalTemplate.AutoTextEntries("Filename and path").Insert Where:= _
    Selection.Range
    Selection.TypeText Text:=" "
    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldDate
    Selection.WholeStory
    Selection.Font.Size = 8
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
    End Sub
    Thanks in advance.

  2. #2
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Perth, Western Australia, Australia
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Filename and Path field in macro (MS Word 2000)

    A quick way to show the full footer is to switch from page view to normal view and then back to page view.

    This causes the header/footer fields to recalculate. If this is a pain to do each time, you could add something similar to your macro.

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 28 Times in 27 Posts

    Re: Filename and Path field in macro (MS Word 2000)

    Fern,

    Near the end of your macro, just above the existing line:

    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

    try adding the following three lines:

    Selection.WholeStory
    Selection.Fields.Update
    Selection.Collapse

    Gary

  4. #4
    Lounger
    Join Date
    Apr 2001
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Filename and Path field in macro (MS Word 2000)

    Thanks, keiran. This does work. Sorry to take so long to express my gratitude.

  5. #5
    Lounger
    Join Date
    Apr 2001
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Filename and Path field in macro (MS Word 2000)

    Thanks Gary. I will try this. Sorry to take so long to say thanks.

Posting Permissions

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