View Single Post
 
Old 03-07-2014, 02:52 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,343
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Ulodesk View Post
Thank you again.

After a half hour of trial and error, I discovered that the way to have the bookmarked text from Text1 come in when the checkbox is checked, rather than unchecked, was to remove from the macro the " + 1" at the end of the line

Code:
.CustomDocumentProperties("CheckNo").Value = .FormFields("Check1").Result + 1
This solution—the only one I could make work—now returns (if that's the right term)

Error! Bookmark not defined

when the box is unchecked, but I can live with that. I had just thought that it would return nothing, i.e., the empty paragraph of the second bookmark..
The correct way to do that in this case is to change what the bookmarks in the source document refer to - simply swap their ranges around.

Doing it the way you did means the field then looks for a bookmark named Check0 in the source document. If you were to add one, the error would go away.
Quote:
I tried duplicating the Update macro as Update2 and changing the line shown above to
Code:
.CustomDocumentProperties("CheckNo2").Value = .FormFields("Check2").Result
to, I thought, correspond to the new references, but that crashed the document without producing the desired result.
Did you also create the new custom document property to go with it? And the corresponding bookmarks in the source document?

Attached is an update to the demo files. the destination file now has two checkboxes, updating Custom Document Properties CheckA & CheckB that the INCLUDETEXT fields now refer to, for the purposes of retrieving bookmarks Check1, Check2, Check3 & Check4 from the source file.
Attached Files
File Type: zip CheckBox Conditional Text.zip (31.4 KB, 18 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote