Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Deleting All Headers and Footers.

Deleting All Headers and Footers

by Allen Wyatt
(last updated September 14, 2018)


If you work with documents you receive from other people, one of the tasks you may routinely need to do is delete all the headers and footers in the documents. One way to do this is to simply select the various headers and footers and delete them, but if the document contains many sections, doing so can be very time consuming. (Particularly if you consider that each section can have up to three different headers and footers.)

Repetitious, time-consuming tasks are always a prime candidate for macros; this is no exception. The following macro will zip right through each section of a document, deleting all the headers and footers that have been defined.

Sub RemoveHeadAndFoot()
    Dim oSec As Section
    Dim oHead As HeaderFooter
    Dim oFoot As HeaderFooter

    For Each oSec In ActiveDocument.Sections
        For Each oHead In oSec.Headers
            If oHead.Exists Then oHead.Range.Delete
        Next oHead

        For Each oFoot In oSec.Footers
            If oFoot.Exists Then oFoot.Range.Delete
        Next oFoot
    Next oSec
End Sub

This macro is very powerful—it doesn't ask if you want to proceed, nor does it consider what may be included in the headers and footers. It simply deletes them all, leaving your document with none. If you regularly process quite a few documents, you can easily assign the macro to a toolbar button, menu item, or shortcut key.


If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1777) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Deleting All Headers and Footers.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


List of Macro Shortcuts in All Open Workbooks

Need a list of macro shortcut keys? It's not as easy in Excel as in some other Office applications, such as Word. It can ...

Discover More

Finding a Device Driver's Version

Device drivers are used to allow a hardware device to communicate effectively with Windows. You might need to know a ...

Discover More

Quickly Filling a Column

Excel has a great (and little known) shortcut for filling a column with information. It comes in very handy when you need ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (menu)

Including Headers and Footers when Selecting All

If you are creating a macro that, in the course of processing your document, needs to update all the fields in the ...

Discover More

Deleting a Header or Footer

When working with existing documents, you may need to delete a header or footer previously created. Here's how you can do ...

Discover More

Form Fields in Headers and Footers

When working with form fields, you may want to place those fields in the header or footer of a document. Word won't let ...

Discover More

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two less than 5?

2017-02-14 10:33:02


This worked great for some of my documents, but now it is saying "Method 'Range' or Object 'HeaderFooter' failed"
Then it gives me the option to End or Debug, neither of which seem to do what I want.

Any idea as to what this might mean or what I could do about it?

2016-11-18 01:44:02


To prevent type mismatch 13 error, define oHead and oFoot as objects instead of HeaderFooter.

2016-10-20 16:59:10


deleting all the headers and footers that have been defined === defined??? where, how??? i ran it. no result.

2016-08-27 00:40:52


Really awesome! I have finished my work very easily within minutes for 1000 pages.

2015-03-27 03:48:01


Hi, Thanks for your Code. it's works Perfectly for all pages. i have to deleted footer for selected page. i have tried to achieve it but i can't. I Would really appreciate your help if you are able to do it for me

2014-06-23 00:57:12

Sally NZ

Thanks for the code but I only want to delete headers and footers on the first page. I tried to modify your code using:
the constant wdHeaderFooterFirstPage but I haven't got it right and can't get it to work.
Would appreciate your help if you are able to give it. Many thanks.

2013-04-19 13:56:43

George M Lee

The macro works great but it deletes my page numbers too. Any way to modify so the page numbers don't delete?

2013-02-21 18:17:39

Andrew Burt

Thanks for the code! I did find one small issue, namely if a header/footer has a text box in it, then your code doesn't catch it. I had a devil of a time figuring out how to delete those too. After some digging I found adding this--

Dim oShape As Shape

For Each oShape In oHead.Shapes
Next oShape

--inside each of your loops, above the "If oHead.Exists Then oHead.Range.Delete", line did the trick. (Likewise for 'foot')

Figured you might want to add that for completeness. Thanks!

2012-11-20 11:03:08


On which line do you get the error, Dom?

2012-11-20 10:53:20


This looks brilliant and exactly what I need. Unfortunately I get a Run time error '13': Type Mismatch

Any idea why this might be? I'm opening documents (Word 2003 & Word 2007) from Excel 2007 and running the macro from there.


2012-11-08 06:10:28


Works great!!! Good job.
Thank you very much

2012-07-22 07:35:14

João Carlos

Thank you so much!

2012-07-13 14:38:58


Desparately need to do this now on an important document but have never run a macro. How do I do this?

2012-01-09 11:43:33


It worked... Thanks!

This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Newest Tips

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.