Solved

How to print a Word 2010 document omitting pictures in header and footer

Posted on 2011-09-13
4
382 Views
Last Modified: 2013-11-05
I have a word document with a .png picture in the header and in the footer (essentially -- letterhead).  I want to create a macro to print this document regularly without the header and footer pictures (in other words print the "letter" without the "letterhead").  Manually -- I can select the picture in the header and in the footer and turn brightness up to 100% - then print - then reset the two pictures BUT how can I do this programatically .. ??  I tried to simply record a macro for this but when recording I was unable to simply click oh the picture in order to affect it.

Hopefully I am being clear.  Please advise.  Relatively urgent .. :-(
0
Comment
Question by:paulflint
  • 2
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Scottyworld earned 500 total points
ID: 36533975
Save the following code as a macro.
It essentially formats the header and footer as hidden, then reverts it back afterwards
 
Sub PrintDocWithoutHeaderFooter()
Dim s As Section
For Each s In ActiveDocument.Sections
s.Headers(wdHeaderFooterEvenPages).Range.Font.Hidden = True
s.Headers(wdHeaderFooterFirstPage).Range.Font.Hidden = True
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = True

s.Footers(wdHeaderFooterEvenPages).Range.Font.Hidden = True
s.Footers(wdHeaderFooterFirstPage).Range.Font.Hidden = True
s.Footers(wdHeaderFooterPrimary).Range.Font.Hidden = True
Next s

Options.PrintHiddenText = False

Dialogs(wdDialogFilePrint).Show

For Each s In ActiveDocument.Sections
s.Headers(wdHeaderFooterEvenPages).Range.Font.Hidden = False
s.Headers(wdHeaderFooterFirstPage).Range.Font.Hidden = False
s.Headers(wdHeaderFooterPrimary).Range.Font.Hidden = False

s.Footers(wdHeaderFooterEvenPages).Range.Font.Hidden = False
s.Footers(wdHeaderFooterFirstPage).Range.Font.Hidden = False
s.Footers(wdHeaderFooterPrimary).Range.Font.Hidden = False

Next s

End Sub

Open in new window

0
 

Author Comment

by:paulflint
ID: 36535124
Very good - the only caveat is that the header also contains two lines of text that I don't want to hide!!  Being the person's name and direct phone line (don't forget this is "letterhead" ) - I just  want to hide the .png picture in the header and footer (the pictures are the firm logo, address, etc. in colour).  What I would like ideally is something that hides just the pictures or even better something that just turns brightness of the picture .png to 100% brightness so it still keeps the space - prints - then "resets" the picture.  I tried to create this by recording these steps but I can't seem to select the picture in recording mode .. :-(.  Any further assistance would be really appreciated !!
0
 
LVL 9

Expert Comment

by:Scottyworld
ID: 36540316
I think the problem you'll face here is that in Word you cannot name/label the image, and therefore cannot select it individually to alter its properties.

The below option would prevent the printing of all images:

In the header, create a text box. Now insert your picture into the text box. This brings your image into the drawing layer of Word.

Now create and run the following macro
Sub Macro3()

    Options.PrintDrawingObjects = False
    
    Dialogs(wdDialogFilePrint).Show
    
    Options.PrintDrawingObjects = True

End Sub

Open in new window


This will stop all drawings from printing, give you the option to print, then reset the option afterwards
0
 

Author Closing Comment

by:paulflint
ID: 36557140
Modified slightly but this was great, thanks.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question