Conditional Images in Word. It must be possible, but how hard is it, and am I just looking in all the wrong places for an answer?
I've been set the task of creating a document with basic text "blah blah blah" set side-by-side with an image. However, the people writing the text sometimes need the image to be black and white, and sometimes need it to be a color version. They do not want two separate documents. Instead, they want a single document, with a macro, or another (extremely simple)
method that let's them switch out the image at will, so that they don't have to keep re-editing the text in two documents.
I have some working knowledge of macros, and have made fill-in forms, and done some basic tweaking of VBA before. I have an old outdated copy of O'Reilly's Writing Word Macros sitting next to me. I've also spent way too much time this week searching for an answer to this.
I found this Word Tips and Tricks
page, which seemed to be really on point. However, they've either glossed over quite a few steps, or it's simply inaccurate. I cannot get it to work.
I also found this incredibly useful article on conditional text (warning, links to a pdf file)
, which was even better, and which taught me all about how to create multiple versions of user guides, text books, etc, in a single document. It even included the code to cut and paste into the vba editor in a nice text attachment. It looked like it was going to be exactly what I needed, and I got it working with text, no problem.
At the end of the article it states that you can use the "tagging" strategy taught by the article for other elements than text, such as a table, row, or column, anything under a selected heading, or a specified combination of styles or font colors.
This is where things break down. I have not been able to tag just an image unless I set it to be in-line with the text (not desired), or also grab surrounding paragraph marks. I tried placing the image and text in a table, but although I can tag the contents of a table, the table itself remains (empty, and sucking up space). I tried creating two alternate sections of text plus duplicate image, but could not find a way to tag the section. Nor could I find a way to set the macro to a style. I have come very, very close to getting it to work, but because of the way I'm grabbing the paragraphs, things become misaligned, the wrong image vanishes and doesn't come back, the formatting goes off...
I feel like I'm close, but I am in that frustrating place where you know enough to understand just how much you don't know. Is it that I need to have a much more in-depth understanding of VBA to pull this off (in which case, it's probably time for me to move on) or am I missing something basic? Is there a useful site out there that could fill in some of what I'm missing?