Skip to main content

How to print word document without header and footer? 

Author: Xiaoyang Last Modified: 2018-09-19

If there are header and footer in your Word document, when printing this document, the header and footer will be printed as well by default. But, sometimes, you needn’t the header and footer to be printed . In this case, the method in this article may help you.

Print Word document without header and footer by using VBA code


Print Word document without header and footer by using VBA code

To print the Word file without header and footer, the following VBA code can do you a favor, please do as this:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. And then, click Insert > Module, copy and paste below code into the opened blank module:

VBA code:Print Word document without header and footer:

Sub PrintDocWithoutHeaderFooter()
    Call SetHeaderAndFooter(True)
    Options.PrintHiddenText = False
    Dialogs(wdDialogFilePrint).Show
    Call SetHeaderAndFooter(False)
End Sub
Sub SetHeaderAndFooter(xBool As Boolean)
    Dim xSel As Selection
    For Each s In ActiveDocument.Sections
        s.Headers(wdHeaderFooterEvenPages).Range.Font.Hidden = xBool
        s.Headers(wdHeaderFooterFirstPage).Range.Font.Hidden = xBool
        s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = xBool
        s.Footers(wdHeaderFooterEvenPages).Range.Font.Hidden = xBool
        s.Footers(wdHeaderFooterFirstPage).Range.Font.Hidden = xBool
        s.Footers(wdHeaderFooterPrimary).Range.Font.Hidden = xBool
    Next s
End Sub

3. After inserting the above code, please press F5 key to run it, and a Print dialog box will be popped out, then you should configure the print settings to your need, see screenshot:

doc print without header footer 1

4. And then, click OK to start printing, the document will be printed without the header and footer at once.

Best Office Productivity Tools

Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!

πŸ€– Kutools AI Assistant: Transform your writing with AI - Generate Content  /  Rewrite Text  /  Summarize Documents  /  Get Quick Answers, all within Word

πŸ“˜ Document Mastery: Split Pages  /  Merge Documents  /  Export Selection in Various Formats (PDF/TXT/DOC/HTML...)  /  Batch Convert to PDF  /  Export Pages as Images  /  Print Multiple Files at once...

✏ Contents Editing: Batch Find and Replace across Multiple Files  /  Resize All Pictures  /  Transpose Table Rows and Columns  /  Convert Table to Text...

🧹 Effortless Clean: Sweap away Extra Spaces  /  Section Breaks  /  All Headers  /  Text Boxes  /  Hyperlinks  /  For more removing tools, head to the Remove group...

βž• Creative Inserts: Insert Thousand Separators  /  Check Boxes  /  Radio Buttons  /  QR Code  /  Barcode  /  Diagonal Line Table  /  Equation Caption  /  Image Caption  /  Table Caption  /  Multiple Pictures  /  Discover more in the Insert group...

πŸ” Precision Selections: Pinpoint Specific Pages  /  Tables  /  Shapes  /  Heading Paragraphs  /  Enhance navigation with more Select features...

⭐ Star Enhancements: Navigate to Any Location  /  Auto-Insert Repetitive Text  /  Toggle Between Document Windows  /  11 Conversion Tools...

Kutools and Kutools Plus tabs on the Word Ribbon
πŸ‘‰ Want to try these features? Download Kutools for Word now! πŸš€
 

 

Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
Rate this post:
0   Characters
Suggested Locations