Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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
            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.Close SaveChanges:=wdDoNotSaveChanges
        DocList = Dir$()
        FirstLoop = False

    Application.ScreenUpdating = True
    Exit Sub

    MsgBox Err.Description
    Exit Sub
End Sub
share|improve this answer
please expand on your answer, @justme. – studiohack Jun 13 '11 at 2:00

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.

share|improve this answer
I need to do this for 19 files, which makes this less feasible. – Ziv May 2 '11 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 '11 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 '11 at 18:57

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.