INCLUDEPICTURE use an alternate jpg if MERGEFIELD "filename".jpg is not valid

100 Views Asked by At

I keep track of hikes we do in an EXCEL spreadsheet. I use WORD to create journal pages using a lot of MERGEFIELDS. I have clean maps of parks. After we do a hike, I use an editor to draw a route on the clean map of where we hiked producing a route map.

I would like to INCLUDEPICTURE the route map if there is one, otherwise a clean map. For these examples "Death Valley Map.jpg" does exist, "Death Valley Map Route.jpg" does not exist.

I cannot see that "{ IF TRUE ..." ever does anything. Is there some WORD option or switch that needs to be set? My problem is that I cannot get any if test to branch false when the file does not exist.

Test Case Test Result
{ IF "Death Valley Map.jpg" } null
{ IF "Death Valley Map Route.jpg" } null
{ IF "Death Valley Map.jpg" "GoodA" "BadA" } GoodA
{ IF "Death Valley Map Route.jpg" "GoodB" "BadB" } GoodB
{ IF TRUE "Death Valley Map.jpg" } Death Valley Map.jpg
{ IF TRUE "Death Valley Map Route.jpg" } Death Valley Map Route.jpg
{ IF TRUE "Death Valley Map.jpg" "GoodC" "BadC" } Death Valley Map.jpg
{ IF TRUE "Death Valley Map Route.jpg" "GoodD" "BadD" } Death Valley Map Route.jpg
{ IF { IF TRUE "Death Valley Map.jpg" } "GoodE" "BadE" } GoodE
{ IF { IF TRUE "Death Valley Map Route.jpg" } "GoodF" "BadF" } GoodF
{ IF { IF TRUE "Death Valley Map.jpg" } <> "" "GoodG" "BadG" } GoodG
{ IF { IF TRUE "Death Valley Map Route.jpg" } <> "" "GoodH" "BadH" } GoodH
{ IF { INCLUDEPICTURE "{ IF TRUE "Death Valley Map.jpg" }" \d } "GoodI" "BadI" } GoodI
{ IF { INCLUDEPICTURE "{ IF TRUE "Death Valley Map Route.jpg" }" \d } "GoodJ" "BadJ" } GoodJ
{ IF { IF TRUE { INCLUDEPICTURE "{ IF TRUE "Death Valley Map.jpg" }" \d } } "GoodK" "BadK" } GoodK
{ IF { IF TRUE { INCLUDEPICTURE "{ IF TRUE "Death Valley Map Route.jpg" }" \d } } "GoodL" "BadL" } GoodL
{ IF { IF TRUE { INCLUDEPICTURE "{ IF TRUE "Death Valley Map.jpg" }" \d } } <> "" "GoodM" "BadM" } GoodM
{ IF { IF TRUE { INCLUDEPICTURE "{ IF TRUE "Death Valley Map Route.jpg" }" \d } } <> "" "GoodN" "BadN" } GoodN

Screen shots in case I didn't type exactly:

screen shot of test cases

screen shot of test results

0

There are 0 best solutions below