Microsoft Word Image Placeholder Option

Microsoft Word Image Placeholder Option

Picture Layout options available in Word. Now, let's apply an option to the three pictures in our example document. To do so, hold down the Ctrl key and click each picture. In the right-hand panel, locate and click the Developer checkbox and click OK. In Word 2007, choose File Word Options and then click the Show Developer Tab in the Ribbon checkbox (from the. In the left thumbnail pane, click the slide layout that you want to add one or more placeholders to. On the Slide Master tab, click Insert Placeholder, and then click the type of placeholder that you want to add. Click a location on the slide layout, and then drag to draw the placeholder.

The Anchorage

Personal website of Gregory K. Maxey, Commander USN (Retired)

Do you have ad-blocking software enabled? While I respect your right to do so, your donations and the minimal advertisements on this site help to defray internet and other costs of providing this content. Please consider excluding this website from blocking or turning off the blocker while browsing this site.

DISCLAIMER/TERMS OF USE

The information, illustrations and code contained in my 'Microsoft Word Tips' are provided free and without risk or obligation.

However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.

If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!


This Microsoft Word Tips & Microsoft Word Help page provides a couple of solutions to the frequently asked question, 'How do I prevent the placeholder text (PHT) in uncompleted content controls from printing?' The solutions provided are a result of collaborative effort with MVP Jay Freedman.

The problem can occur often. You prepare a form and send it out for completion. Users complete part of the form and leave some of the content controls uncompleted. When the form is returned and printed the PHT in the uncompleted content controls are printed. This results in an unsightly finished form.


Representation of a printed document with bubble added for emphasis

Unfortunately there isn't a simple solution. There is no option in Word to exclude printing content control PHT, and without an intensive form validation process, you can't make the user fill out each field.

Each of the automated solutions provided require VBA which means the template and form documents must be macro enabled (i.e., .dotm and .docm extensions).

Method I - Detect Events/Intercept Commands/Modify PHT Style

The first method employs the application event 'DocumentBeforePrint,' repurposed Print commands and a temporary modification of the document's Placeholder text style.

Placeholder text, like most text in Word, is defined by a style. If you temporarily set the Placeholder text style font property .Hidden to true, set the application options .PrintHiddenText property to false and print the document the PHT text will not be printed. This can of course be done manually if you have a willing group of form users, but an automated process requires a VBA solution.

  • Open Word, open the VB Editor (VBE) (i.e., press ALT+F11) and open the Normal project.
  • Using the VBE Insert menu, insert a class module and a standard module in the Normal project. Rename the class module 'clsPrint.' Rename the standard module any meaningful name. I used modPrint.

Notes:
1. The Normal project is project associated with the Normal template. It is global and always loaded.
2. The method is developed for Word 2010, but includes all necessary code for Word 2013 and 2007 users. Some elements (e.g., the class module) is not required for Word 2007.

  • Paste the following code in the class module.
  • Paste the following code in the standard module:
  • Save the template project. Close the VBE. Close and restart Word.
  • Try it out on documents with and without uncompleted content controls.

Note: You have to close and restart Word in order fo the AutoExec macro to initialize the clsPrint class.

The following is an explanation of how the process more or less works:

  • The AutoExec macro runs automatically each time you start Word. It sets the initial variables and if the application is Word 2010/2013 it initializes the variable session_clsPrint to an instance of the class module clsPrint. The Class_Initialize procedure in the class initializes the oWordApp variable to the Word application object.
  • When a Word 2010 user clicks File>Print>Print that action triggers the clsPrint oWordApp_DocumentBeforePrint procedure. This procedure:
  • Stores the current option value
  • Ensures the 'print hidden text' option is off
  • Set the the placeholder text style font 'Hidden' property = True
  • Calls the built-in Word 'PrintPreviewAndPrint' command. This is the command executed by the backstage view Print button. Unlike most other user interface commands, this one can't be intercepted using the usual VBA method of naming a procedure the same as the command -- Thanks, Microsoft!
  • After a defined 5 second delay the procedure calls the RestorePlaceholders procedure located in the standard module. The delay should provide ample time to let the print command finish spooling the document to the printer queue
  • Restores options to the stored setting

Notes:
1. If you often print large forms, you may want to increase the delay. This delay is needed because changing the Hidden attribute immediately (at the end of the DocumentBeforePrint routine) would happen before the PrintPreviewAndPrint command has time to spool the content to the printer queue.
2. Due to a plethora of complications associated the inability to intercept the PrintPreviewAndPrint command, the PHT will still appear visible in the backstage preview pane when you select the File tab in Word 2010/2013, but that visible PHT IS NOT printed.
3. If you really want to see what the document will look like with PHT suppressed then add the PrintPreviewAndEdit control to your QAT. In Print Preview and Edit mode, the PHT is suppressed.
4. If while in the Print Preview and Edit mode you select the Print Preview and Print control the backstage view and preview appears with the PHT suppressed.
5. If you print (i.e, select the 'Print' command) the PHT is suppressed in the printed document and then restored after the short delay.
6. However, if you don't print and return to the document by clicking one of the other tabs on the ribbon then the PHT will not be restored and remain formatted as hidden text.
7. In this situation, you can restore PHT by immediately switching to Print Preview and Edit mode then closing the mode.

  • When a Word 2007 user clicks the Word Menu>Print>Print command the procedure named 'FilePrint' intercepts the built-in 'FilePrint' command. The procedure performs functions similar to the event procedure described above. A delay, however, is not required.
  • The FilePrintDefault procedure intercepts the QuickPrint command in both Word 2007 and 2010/2013. It functions similar to the FilePrint procedure
  • The remaining procedures intercept the named built-in commands to display the Print Preview screens.
  • The class and module procedures have no effect on documents that don't contain content controls, or documents in which all content controls are completed by the user.

Method II - Detect Events/Intercept Commands/Modify PHT Object

The second method, similar to the first, employs the application event 'DocumentBeforePrint,' repurposed Print commands and a temporary alteration of the PHT object itself.

Placeholder text, is a bit peculiar. While it appears to be text, a content control's .PlaceholderText property is actually a Building Block object with a value. For a more in depth discussion see: 5 Curiosities about Placeholders in Word Content Controls (for developers). If we temporarily set the .PlaceholderText property to a zero width space (i.e., ChrW(8203), before printing and restore then original PHT after printing the results will be similar to method I. The code is a bit more complicated and the only advantage is we don't tinker with user options or restrict printing of hidden text in general.

The jury is still deliberating if there is any real advantage over either method, but I use method II in my Content Control Tools Add-In. So here it is:

  • Open Word, open the VBE and open the Normal project.
  • Using the VBE Insert menu, insert a class module and a standard module in the Normal project. Rename the class module 'clsPrint.' Rename the standard module any meaningful name. I used modPrint.

Note: If you have already created the modules using method I then simply delete the existing content in the modules. Do not attempt to use both methods simultaneously.

  • Paste the following code in the class module.
  • Paste the following code in the standard module:
  • Save the template project. Close the VBE. Close and restart Word.
  • Try it out on documents with and without uncompleted content controls.

The process and procedures are similar to Method I, instead of changing the PHT style, it:

Ms Word Image Placeholder

  • Loops through the document storyranges to count the CCs and store the CC placeholder objects.
  • Sets each CC PHT object value to a single zero width space.
  • Prints/Print Previews the document.
  • Loops through the document storyranges to restore original PHT.

Method III - Document Content Control Events/Custom Placeholder Text

Method III employs an individual document template, the Document_ContentControlOnEnter & Document_ContentControlOnExit events and custom PHT applied dynamically as the user completes the form.

Microsoft Word Image Placeholder Option

  • The template should be setup as illustrated in the example below:

Design Mode view
  • Open the VBE, open the templateProject, expand the Microsoft Word Objects folder.
  • Double click the ThisDocument class module. In right side code window, select the Document object.
  • Select all existing code and paste in the following code:
  • Save and close the template and create a new document based on the template.

Unlike the previous methods, this method has no relationship with the application print processes. It simply uses the built-in document events to dynamically apply or remove a visible placeholder text as the user navigates the form.

  • When the form is initially created (new document) or opened, the CC titled 'Name' is selected for user input.
  • If the exits the CC without providing an input, the placeholder text is set to a single space.
  • When the user enters a CC, if that CC is showing placeholder text (even a non-visible single space), a custom visible placeholder text prompt is presented.
Microsoft Word Image Placeholder Option

Note: This method is the least robust since it is possible that a user enters a CC displaying the visible placeholder text and then prints the document without first exiting the CC. You, or your users, must be sure to physically 'exit' any uncompleted document CC.

Conclusion

If properly applied each of the three methods will result in a more appealing printed form.

That's it! I hope you have found this tips page useful and informative.

PAYMENTS/DONATIONS

Do you want to make a payment for consulting work or donate to help support this site?

PayPal is a safe, easy way to pay online.

Use the appropriate currency 'Donate' button to make a payment or donation.


Search my site or the web using Google Search Engine

Have you ever wanted to add placeholder text in a Microsoft Word document?

For instance, you might be planning the layout for a newsletter or proposal, but you (or another subject matter expert) have not written the articles or text for the project. Placeholder text can be dropped into the spot until you receive the real text for your project.

To add lorem ipsum text in Word:

  1. Place the cursor where you would like the text. Keep in mind that placeholder text can go anywhere you would normally type text (text boxes, columns, sidebars, tables, etc.).
  2. Type =lorem()
  3. Press Enter.

Word inserts multiple paragraphs of lorem ipsum, which is a dummy text that has no meaning but looks like a real text. You can control how much lorem ipsum is produced by adding arguments to your function. For example, =lorem(12,3) produces 12 paragraphs with 3 sentences in each.

If you are not a fan of lorem ipsum, you can also enter random English text to the document as a placeholder.

To add random English text in Word:

Microsoft Word Picture Placeholder

  1. Place the cursor where you would like the text.
  2. Type =rand()
  3. Press Enter.

Microsoft Word Image Placeholder Options

Word inserts multiple paragraphs of actual English text. Again, you can control how much text is produced by adding arguments. =rand(8,5) produces 8 paragraphs with 5 sentences in each.

Now you know how to add placeholder text anywhere you would normally type text in Microsoft Word! If you are interested in learning more, consider registering for one of our online Microsoft Word courses or request a quote to bring one of our experts to your location.

Share this:

Categories

Tags