1

I have a folder of Word files that I need to print. I'm looking for a way to embed the file names as header/footer on these pages, if possible even number the pages to keep them organized.

Is there a way to do this?

I'm using Office 2007 on Windows 7.

3 Answers 3

1

From this site, here is a macro that prints all documents in a given folder with the full file path added into the header, right aligned, 8pt Arial:

Sub PrintWithFileNames()
    On Error GoTo err_FolderContents
    Dim FirstLoop As Boolean
    Dim DocList As String
    Dim DocDir As String

    With Dialogs(wdDialogCopyFile)
        If .Display 0 Then
            DocDir = .Directory
        Else
            MsgBox "Cancelled by User"
            Exit Sub
        End If
    End With

    If Documents.Count 0 Then
        Documents.Close SaveChanges:=wdPromptToSaveChanges
    End If

    Application.ScreenUpdating = False
    FirstLoop = True

    If Left(DocDir, 1) = Chr(34) Then
        DocDir = Mid(DocDir, 2, Len(DocDir) - 2)
    End If

    DocList = Dir$(DocDir & "*.doc")

    Do While DocList ""
        Documents.Open DocList
        Selection.EndKey Unit:=wdStory
        ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader

        With Selection
            .EndKey Unit:=wdStory
            .Font.Name = "Arial"
            .Font.Size = "8"
            .ParagraphFormat.Alignment = wdAlignParagraphRight
            .TypeText vbCr & ActiveDocument.FullName
        End With

        ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
        ActiveDocument.PrintOut
        ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
        DocList = Dir$()
        FirstLoop = False
    Loop

    Application.ScreenUpdating = True
    Exit Sub

    err_FolderContents:
    MsgBox Err.Description
    Exit Sub
End Sub
1
  • 1
    please expand on your answer, @justme.
    – studiohack
    Jun 13, 2011 at 2:00
0

In the header or footer, you can add a "field" that is the file-name. How you insert fields, is dependent on the version of Word you're using. After adding the filename-field to your header/footer... and saving your documents in a folder, you can simply right-click & click print.

3
  • I need to do this for 19 files, which makes this less feasible.
    – Ziv
    May 2, 2011 at 18:25
  • Less feasible how? If the files are created properly, printing them is quick & simple. Modifying 19-files is another subject. It's simply a matter of ... you should-have done it correctly to start with. Word is designed to create printed-documents... not documents that can be sent to a parser to modify the output before printing.
    – TheCompWiz
    May 2, 2011 at 18:27
  • These are summaries sent from my teacher over a period of time in several emails, I did not create them. And of course I meant that editing them would be hard, I know how to right click>print.
    – Ziv
    May 2, 2011 at 18:57
0

One idea is to print a header page before each document. Your printer settings may allow for this and may even include the file name from word automatically. If not, you could write a quick batch script that will print the file name page then print the document.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .