Conditional Formatting In Word

  1. Conditional Formatting In Word Table
  2. Conditional Formatting In Word 2016 Table
  3. Conditional Formatting In Word 2016
  4. Conditional Formatting In Word 2010
  5. Conditional Formatting In Word 2010
  6. How To Use Conditional Formatting In Word
  7. Conditional Formatting In Word Mail Merge

Conditional Formatting in Microsoft Word 2010: Go to 'Replace', click in the box next to 'Find what' and type in your condition. (If your condition is more than just words and/or numbers, check in the 'Format' or 'Special' buttons to see if you can (or need to) more closely identify what you want Word to find.). IF statements allow you to compare two values and display document content based on the result of the comparison. When used in a Word template, IF fields are. Word templates introduced in CRM Online and CRM 2016 are not the easiest contraptions to edit. One of the questions that popped up in a recent conversation was how to use conditional IF in the document generation. Tl;dr To refer to the control values after the document has been generated, wrap. Create a number value for the word by creating an additional column. For example 'Yes' as '1' and 'No' as '2'. Make sure the additonal column value is a whole number and not text. Apply and close; Go to the field, use the drop down in the fields section and choose 'conditional formatting' - choose Background or Font colour. Choose 'Rules' for. Another option would be to use a Word document with an OLE Microsoft Excel object. The drawback is the users would need to know how to use this embedded Excel object. The third way you could go is to use Microsoft Excel and use the inbuilt Conditional Formatting of Excel.

Word templates introduced in CRM Online and CRM 2016 are not the easiest contraptions to edit. One of the questions that popped up in a recent conversation was how to use conditional IF in the document generation.

tl;dr

To refer to the control values after the document has been generated, wrap content controls using bookmarks defined at the control container level.

Longer

CRM fields are defined as Content Controls and in theory we could have written some simple VBA using ContentControl object. Except that CRM does not play nice when generating the document and simply replaces all content controls with the record values.

The solution is to wrap the content controls using the bookmarks defined at the container level, i.e. cell, row, paragraph, etc. Then this bookmark can be used as a reference in a conditional expression of the IF field.

For example, to insert conditional text depending on the total invoice value:

Conditional Formatting In Word Table

  1. Extract the Invoice template that comes with the sample data and save it under a different name.
  2. Open the template, find total amount, select the entire table cell and click Insert > Bookmark.
  3. Type totalbookmark as a bookmark name, click Add.
  4. Delete the words “Thank you for your business” and click Insert > Quick Part > Field.
  5. Select IF field and type the following field code:
    IF totalbookmark > 100 “Thank you for you business!” “Thanks for nothing!”
  6. Click OK. Hint: to see and edit field codes in the document, press Alt-F9.
  7. Save the file and upload to CRM as a new template.
  8. Create an invoice and generate the invoice document.
  9. Enable document for editing, press Ctrl-A to select the entire content and press F9 to refresh the field content
  10. Depending on the total value of the invoice, the document will say “Thank you for your business!” or “Thanks for nothing!”
Tables

Conditional Formatting In Word 2016 Table

It’s not a full automation that potentially could be improved with some VBA (I’m not 100% sure if it will work) but it’s a step in the right direction and a cheap way to add some pizazz to your documents.

If you’ve ever managed 2 versions of a similar document (esp. in SaaS organizations), then you know how creating multiple versions of the same document for different audiences is a pain.

One classic example is a user guide and an admin guide.

Another is a public, external facing document and then having to maintain a private, internal version that contains that extra information.

You know how time-consuming and laborious this is, and you’ll know how managing them is tedious and often problematic.

Word’s VBA Can Help

Conditional Formatting In Word 2016

However, with just a little extra effort, an understanding of how we can use Microsoft Word’s functionality to the best of our ability, and a sprinkling of VBA to top it all off, we can change all that.

Conditional Formatting In Word 2010

Word

Background

Several years ago, I was asked to help out with a national park’s project.

Conditional formatting in word 2010

They had one external document, that was available to the public, and they also had an internal version for their park’s supervisors…

Though these contained several hundred pages, they had always managed these documents separately.

Not only did that involve a huge amount of extra work, but it’s also risky for human error, updating, checking, cross-referencing, and so on.

Conditional Formatting In Word 2010

So I came up with the idea of using conditional formatting to make their lives easier.

Limitations of this Method

In this respect, Word isn’t quite as good as other programs, but it’s more than capable of managing 2 types or versions of a document.

(You could stretch it to 3 types, such as a user guide, admin guide, and a dev guide, but from my initial investigations, it does get rather clunky – 2 types is best.)

Use Cases

Here are some use cases:

  • a public-facing, shorter version versus a private/internal longer version of the same document
  • a user guide versus an admin guide
  • user/dev guide
  • multi-level API guide
  • software user guide with multiple levels (for upsells)
  • any type of complex guide where explanatory text is required
  • etc.

(I even used this for an email marketing course that I co-authored several years ago: where guidance text was provided for each email to prompt the user about what to write here.)

There are many uses for this type of functionality.

How Conditional Formatting Works

How To Use Conditional Formatting In Word

As with everything Microsoft Word, conditional formatting relies on Word’s styles.

If you look at the font dialog box (Ctrl+D), you’ll see we have the Hidden attribute.

We use this attribute for each of our conditional text styles. This method means you can create as many styles as you need, and we then use Word’s VBA to show and hide them.

By creating specific styles, we can then use Word’s VBA to show and hide them. As the video below shows, we do this as an on/off toggle.

In doing so, we can clearly see what:

  • We’re working on.
  • Text is in what level.
  • The end result will look like.

Conditional Formatting In Word Mail Merge

Once we’re done, and still using VBA, we can then export the desired results to any printer we like.

In this template, I have configured it to send to my default printer for a hard copy or, as I show in this demo, to pdf.

Here’s the video:

Want a free copy this template?

If you want a free copy of this template, message me using the contact/assistance box, below. I’ll happy send it across.