Conditional Formatting with Microsoft Word

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

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.

Background

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

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.

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

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.

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 happily send it across.

Leave a Reply

  • Even us power users curse Word sometimes, especially when for some unknown reason, one of our styles displays a black box instead of the number that it should show, corrupting the Table of Contents in the process. Or we fix a paragraph multiple times and it keeps insisting on changing back. Or we inherit a one-hundred page document that needs totally reformatting, one paragraph at a time. Enter Mr. Crowley’s course, Microsoft Word 2016 for Beginners*. 

    The one thing I liked best about the course was Mr. Crowley’s teaching style, clear, concise and reasonably paced. The material is thoughtfully laid out, one lesson flowing smoothly into the next.  Don’t let the course name fool you. After covering the basics, this course shows you how to do virtually anything that you might need. Document gotten so big that it could use a Table of Contents? Module 10. Need an index? Module 16. Want a numbered list and it needs sorted? Module 13. 

    These are just a few of the items taught in this course. You’ll definitely be scratching your head, thinking, “wow, I didn’t know Word could do that.

    Mr. Crowley could be called a “style and section evangelist”. He never misses an opportunity to emphasize that any misbehaving document probably has its roots in poorly-applied or unused styles and sections. I suspect this may be the root cause of my black squares for numbers identified earlier. After completing the course, the main benefit I have a better appreciation of Word’s bells and whistles, along with a resource for how to do things. I would recommend this course to users of all skill levels.  

    Rick Robertson Van Horn

    Sr. Systems Analyst & Sr. Programmer, & Word Power User

    *Note: this was the original name for this course.