Join 3,512 readers in helping fund MetaFilter (Hide)

Please use small words not written in VBA
February 17, 2012 11:58 AM   Subscribe

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?

posted by instead of three wishes to Computers & Internet (7 answers total) 3 users marked this as a favorite
Are you using Word 2010? There is a "Change Picture" item on the Format => Picture Tools ribbon that allows you to switch one picture with another very quickly.

I hope I'm understanding your question correctly. If I am, you could record one macro that uses "Change Picture" to switch to the black and white version, and another macro that allows the user to change to the color version. I'm not sure that a macro would be much quicker than simply using the Picture tools menu, though.
posted by Currer Belfry at 12:19 PM on February 17, 2012

Is there a reason you can't link the same text into two different documents, so that edits in one show up in the other? Then you could just put the color picture in document A, the black-and-white one in document B, and edit the text in whichever one was convenient.

This could get tricky if multiple people might edit at the same time, I suppose.
posted by amtho at 12:44 PM on February 17, 2012

The technical problem with this solution is it requires that the document always travel in a folder with the two photos, all as separate files. I need this to be a single file which contains everything, and can be emailed back and forth if necessary without separate attachments.

The real life problem with this solution is that it would be require me to be the person who edited the document every single time. As simple as that manuever is, I cannot require it of the people who will be working with this document day-to-day. Hence the need for something like a macro button they can click.
posted by instead of three wishes at 12:47 PM on February 17, 2012

Is there a reason you can't link the same text into two different documents, so that edits in one show up in the other? Then you could just put the color picture in document A, the black-and-white one in document B, and edit the text in whichever one was convenient.

I considered this, but it is the requirement that it be a single document they can quickly swap the image on wherever they are that has got me stumped. There will be way too many chefs in the kitchen. In the end, if I can't come up with something, I'm probably going to recommend that.
posted by instead of three wishes at 1:11 PM on February 17, 2012

Put both pictures in, one behind the other, and then send the one you don't want to the back.
posted by mgar at 2:02 PM on February 17, 2012

mgar - Elegant in its simplicity. I'll make use of your idea, and set behind the images will be props to mgar, or maybe in the document properties.
posted by X4ster at 8:53 PM on February 17, 2012 [1 favorite]

If they ckick on the picture and use Format-Adjust-Recolor they can make it black and white or colour as required.
posted by KateViolet at 5:45 PM on February 18, 2012

« Older I have fine, long, wispy, ultr...   |  I have a PDF document and a sp... Newer »
This thread is closed to new comments.