Solved

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

Posted on 2011-09-13
4
384 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

724 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