Solved

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

Posted on 2011-09-13
4
383 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…

737 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