Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

setting folder properties to input footer into saved doc with location of folder.

A user in our office wants to setup a system so that when she saves a document in a particlular folder it puts the file location into the footer of that document. How can i accomplish this ?
0
Itomicltd
Asked:
Itomicltd
  • 3
  • 2
1 Solution
 
GrahamSkanCommented:
If she inserts a FileName field that has a \p switch, the whole path, including the file name will display. Otherwise some VBA code will be needed.

Please mention the Word version if any clarification is required.
0
 
ItomicltdAuthor Commented:
Can you advise how she would do this. Word 2007.
0
 
GrahamSkanCommented:
Select the position in the footer-

Insert tab, text group, Quick Parts dropdown, Field... item to open the Field dialogue.

Select 'FileName' from the list, tick the 'Add path to filename' box and click on OK.

Note that if the document is Saved As later, the field will need to be updated to show the latest setting. The simplest way of doing that is to select the footer (including the field) and press F9.

There is also an Option in the Options Display item to 'Update fields before printing.'
0
 
ItomicltdAuthor Commented:
The user wants this to automatically happen when she saves into a particular location, so the footer is automated upon save. I'm not sure if this is actually possible !!!!
0
 
GrahamSkanCommented:
It'll have to be VBA, then. Put this code in a code module of the Normal template:
Sub FileSave()
    If ActiveDocument.Path = "" Then
        FileSaveAs
    Else
        ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Text = ActiveDocument.Path
    End If
End Sub

Sub FileSaveAs()
    Dim dlg As Dialog
    Dim strFileName As String
    Dim strPathParts() As String
    Dim strPath As String
    Dim i As Integer
    
    Set dlg = Dialogs(wdDialogFileSaveAs)
    With dlg
        If .Display Then
            strFileName = dlg.Name
            strPathParts = Split(strFileName, "\")
            i = UBound(strPathParts)
            If i = 0 Then
                strPath = Application.Options.DefaultFilePath(wdDocumentsPath)
            Else
                ReDim Preserve strPathParts(i - 1)
                strPath = Join(strPathParts, "\")
            End If
            ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Text = strPath
           .Execute
        End If
    End With
End Sub

Open in new window

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now