![]() |
|
![]() |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
Hi,
I have a template that contains a number of bookmarks to populate information from a system when the Word file is created. These bookmarks are formatted with a white font as it is being read by a software and not to be printed out if the file is printed. The bookmarks contain information about the recepients address etc and I'm trying to figure out a way to warn the user if any of the "hidden" bookmarks ends up with an error. I have tried to create a separate bookmark called "DokA_ID" which spans over all bookmarks with address information. I then created a cross reference in the document with a suggested code that I found online: Code:
{ IF { REF DokA_ID } = "" "Error! Bookmark not defined." } I then tried to rename the bookmark to "DokA_ID2" in order to test if the error message would be displayed but with no luck. Does anyone have any suggestions on how to acheive this check with an IF statement? I can't use VBA as the templates are uploaded to a system that don't allow for VBA documents. I have tried various IF statements previosly and never managed to get them to work. |
#2
|
||||
|
||||
![]()
Given that the information isn't to be printed, why are you writing into the document instead of populating document variables or custom document properties? Far simpler than writing to bookmarks.
As for your field coding, none of the field braces (i.e. {}) can be typed, which is what your problem description suggests you're doing. They should be created (in pairs) by pressing Ctrl-F9. Regardless, the field code you're trying to use probably won't work the way you want it to. As coded, it returns an error message if the bookmark contains no data - which can be a perfectly valid result; it certainly doesn't mean what your output message suggests. If the problem is you're trying to deal with is that a bookmark has been deleted (which poor coding or a user can do all too easily), Word will already display: Error! Reference source not found. So, if that's what you're trying to suppress, your field coding should be along the lines of: {IF{REF BkMk} = "Error!*" "" {REF BkMk}} None of this would be necessary if your document used document variables, especially, or custom document properties. The advantage of using document variables is that users can't delete them. Then, all your document needs instead of bookmarks and REF fields is just a set of DOCVARIABLE or DOCPROPERTY fields.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
Tags |
error, field code, ref |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
grahamsims | Word | 8 | 12-03-2020 10:50 AM |
Word 2007 - Document returns to first page without warning and does not save last edits. | paulbasel | Word | 11 | 12-16-2018 04:36 PM |
![]() |
lodi123 | Word | 2 | 03-28-2017 11:24 PM |
Problem opening Outlook Today. Error Message: Cannot display the folder. Cannot find this file. Veri | atwnsw | Outlook | 0 | 11-01-2015 05:05 PM |
Microsoft Office 2010 programs display error message "Application has failed to start | SamSR | Office | 1 | 02-15-2011 07:15 AM |