Bookmarks and respective reference fields

S

singeredel

I have set up a bookmark called "ReferringPhysician" in a document as well as
a reference field {ReferringPhysician} to repeat the bookmark text at another
location in the document. The fields are updating fine.

Since I have a variety of different bookmarks and reference fields, I need
to know how to reference a specific reference field so that the particular
field and some surrounding punctuation can be deleted from the document if
the variable for the ReferringPhysician bookmark is blank or empty of text.

I think I have figured out how to format the text that appears in the
various fields to take on the default paragraph font, as follows:

Dim oFld As Field

For Each oFld In ActiveDocument.Fields
oFld.Result.Style = "Default Paragraph Font"
On Error Resume Next
Next

Is there any way to include in this code to delete the { ReferringPhysician
} field as well as the preceding comma and space and trailing comma. The text
would appear as follows in the template itself:

"Thank you, { ReferringPhysician}, for participating..."

If there is no variable information for the bookmark "ReferringPhysician", I
want the text in the document to look as follows:

"Thank you for participating..."

Thanks for any help!
 
S

singeredel

I tried sticking your code into my template and highlighting it and making a
field using Ctrl+F9 (substituting "ReferringPhysican" for "RP" in your code),
but it doesn't insert any text into the document when the variable for the
bookmark has a result.

Is this what you meant for me to do?
 
S

singeredel

Actually, what seems to happening is that the doctor's name is being inserted
into the field itself rather than as text in the document.
 
G

Greg Maxey

You have nested fields here:

Type out IF RP <>"", RP,"""
Select the first RP and press CTRL+F9, select the second RP and press
CTRL+F9 then select the whole expression and press CTRL+F9.

If the bookmarked RP is empty the field should be empty, if it is
something like Dr. No it should show , Dr. No,
 
S

singeredel

I also have another problem. It appears my code for Default Paragraph Font is
only making the field the default font and not the text being put in the
field. Any suggestions on how to make the resulting text the default font of
the paragraph?
 
S

singeredel

I can't seem to get it to work. I tried what you suggested about using
Ctrl+F9 on each {ReferringPhysician} separately and then selecting the whole
statement and Ctrl+F9, but it doesn't put the text of the bookmark in.

Sometimes you used """ and sometimes "" in your examples. I tried both ways
but am not able to get it to work.

Thanks...
 
S

singeredel

For information, I discovered what the problem was regarding applying the
default paragraph font. I had a "ActiveDocument.Fields.Update" statement
following my code to apply the default font and therefore it was reverting
back to the bookmark formatting.

I still have not been able to get the nested code to work, however.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top