Share via

Printing blank data from a content control

Anonymous
2010-08-24T20:11:37+00:00

Hi,

I'm using content controls on a Word 2010 form. Is there any way to get the data in the content control to print blank if there is no data for a particular content control? I can only get it to print the placeholder.

Thanks, Dennis

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Jay Freedman 207.7K Reputation points Volunteer Moderator
2010-08-25T15:25:00+00:00

Dennista wrote:

BTW - just to be clear about my reasons for wanting a non-code

answer: I'm trying to create a template that I can share with 4-5

others and they are mostly computer novices. I am trying to make life

as simple as possible for them. Having to run a macro to print - even

if it's as simple as having to click a different "Print" button - is

going to throw some of them.

You can make the macro run automatically when the user clicks the Quick Print button that can be placed on the Quick Access Toolbar just by changing the first line from

Sub PrintWithoutPlaceholderText()

to

Sub FilePrintDefault()

For the Print button on the Office button menu (and the Ctrl+P shortcut), add this modified version as a second macro in the same template:

Sub FilePrint()

    Dim cc As ContentControl

    For Each cc In ActiveDocument.ContentControls

        If cc.ShowingPlaceholderText Then

            cc.Range.Font.ColorIndex = wdWhite

        End If

    Next

    Dialogs(wdDialogFilePrint).Show

    For Each cc In ActiveDocument.ContentControls

        If cc.ShowingPlaceholderText Then

            cc.Range.Font.ColorIndex = wdAuto

        End If

    Next

End Sub


Jay Freedman

MS Word MVP  FAQ: http://word.mvps.org

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

Answer accepted by question author

Jay Freedman 207.7K Reputation points Volunteer Moderator
2012-08-11T00:52:11+00:00

<Edit: This refers to the code in my post of January 26, 2012.>

You could theoretically put slightly adapted code into the document itself. But doing so would result in a very scary antivirus warning every time anyone opens the document, unless you digitally sign the code with a certificate issued by a public certificate authority such as VeriSign. That gets expensive.

The preferable method is the second one you mentioned, saving the form as a template and putting the code into that. It needs a small tweak: Remove the Sub AutoExec() procedure from what I posted before, and replace it with these three:

Sub AutoNew()

    Set myPrintClass = New PrintClass

End Sub

Sub AutoOpen()

    Set myPrintClass = New PrintClass

End Sub

Sub AutoClose()

    Set myPrintClass = Nothing

End Sub

Unlike the "global" Normal.dotm template's code that runs whenever the Quick Print button is clicked in every document, this will affect only documents based on this specific template (and, I think, other documents during the time the form is open).

One other thing: In order for the macros to run at all, the folder where the template is stored must be made a "trusted location" in the File > Options > Trust Center > Trust Center Options > Trusted Locations dialog. If the folder is on a network share, the option at the bottom for "Allow Trusted Locations on my network" must be checked first. This location will have to be set individually by each user (I think there may be a way to set it in Group Policy, but that's outside my area). Also, to have the template appear in the My Templates dialog, the network folder should be set as the Workgroup Templates folder for each user.

Was this answer helpful?

0 comments No comments

23 additional answers

Sort by: Most helpful
  1. Anonymous
    2012-04-26T17:13:42+00:00

    Here is the fun part and why this particular thing is so frustrating for users.  This problem has existed since the dawn of time, with regard to MS Word.  No one fixes it.  Is there someone from Microsoft that can answer as to why such a simple feature called: Do you want to print content controls? [X] Yes [ ] No was not built in, since we first started complaining about this back in 1996?  As a customer, if I have to program a Macro to print a stinken form the way 99% of the planet wants their form printed, I have a hard time making a case for my team members to use the product.  Everyone else lets me color the background of a form field?  Why not this product?  If you are going to enable forms, why not enable the functionality forms require to be usable?  Why give your customers half an apple when they want the whole apple? We tell you we want the whole apple, we write blogs about the apple needing to be whole, when we buy.  We even tell you that we will buy more apples, if only you would give us the whole apple!  But no, Microsoft's engineers think to themselves, if we give them the whole apple, they will become fat, and will loose their jobs and not buy any more apples.  What data do you have to suggest that???  If we have a printable form, will we print more, and burn down entire rain forests because we now have a form we can send out, have people print, and save us time and aggravation? Adobe Acrobat lets you build a form, and control what gets printed and what does not, and has done this since, what 1996?  I have complained about this since 1997.  How does that add campaign go?  I am "Windows 7"?  What about "I am a happy customer"?  Did anyone figure out that filling out and signing e-mail based forms that could be printed, was a good thing?  Then why insist on a macro, when 99.999% of anti-virus programs block macro enabled Word documents?  Grrrrrrrr.

    Was this answer helpful?

    6 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2012-03-22T11:31:45+00:00

    If it is still of interest, I was trying the same and did the following:

    Search and replace all "click here to enter text." with a space.

    Was this answer helpful?

    3 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2017-03-13T17:32:06+00:00

    Should the macro run automatically when you hit print?  I am using office 2016, and if i go to "Macros" then "Run", it automatically prints without the content control boxes showing.  But if i just hit "print" it prints out WITH the content control boxes.

    I want to be able to send a fillable form to others and have them print out, sign, and send back.  I don't want to have to explain to them how to run a macro - is there a way to make the macro run automatically when you hit print?

    Thanks very much for your help.  Agree with USGrant7 that it's unfathomable that Microsoft can't just fix this with an option to not have the content controls show up when printing.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments