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!
--
singeredel (Julie)

Re: Bookmarks and respective reference fields by Greg

Greg
Fri Jun 02 12:44:09 CDT 2006

Instead of a macro why not just used fields:

{ IF {RP} <>""", {RF},"""}

singeredel wrote:
> 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!
> --
> singeredel (Julie)


Re: Bookmarks and respective reference fields by singeredel

singeredel
Fri Jun 02 13:13:02 CDT 2006

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?

--
singeredel


"Greg Maxey" wrote:

> Instead of a macro why not just used fields:
>
> { IF {RP} <>""", {RF},"""}
>
> singeredel wrote:
> > 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!
> > --
> > singeredel (Julie)
>
>

Re: Bookmarks and respective reference fields by singeredel

singeredel
Fri Jun 02 13:18:02 CDT 2006

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.
--
singeredel


"Greg Maxey" wrote:

> Instead of a macro why not just used fields:
>
> { IF {RP} <>""", {RF},"""}
>
> singeredel wrote:
> > 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!
> > --
> > singeredel (Julie)
>
>

Re: Bookmarks and respective reference fields by Greg

Greg
Fri Jun 02 13:31:53 CDT 2006

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,


singeredel wrote:
> 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.
> --
> singeredel
>
>
> "Greg Maxey" wrote:
>
> > Instead of a macro why not just used fields:
> >
> > { IF {RP} <>""", {RF},"""}
> >
> > singeredel wrote:
> > > 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!
> > > --
> > > singeredel (Julie)
> >
> >


RE: Bookmarks and respective reference fields by singeredel

singeredel
Fri Jun 02 13:37:02 CDT 2006

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?
--
singeredel


"singeredel" wrote:

> 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!
> --
> singeredel (Julie)

Re: Bookmarks and respective reference fields by singeredel

singeredel
Fri Jun 02 14:41:02 CDT 2006

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...

--
singeredel


"Greg Maxey" wrote:

> 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,
>
>
> singeredel wrote:
> > 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.
> > --
> > singeredel
> >
> >
> > "Greg Maxey" wrote:
> >
> > > Instead of a macro why not just used fields:
> > >
> > > { IF {RP} <>""", {RF},"""}
> > >
> > > singeredel wrote:
> > > > 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!
> > > > --
> > > > singeredel (Julie)
> > >
> > >
>
>

RE: Bookmarks and respective reference fields by singeredel

singeredel
Sat Jun 03 09:04:01 CDT 2006

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.
--
singeredel


"singeredel" wrote:

> 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?
> --
> singeredel
>
>
> "singeredel" wrote:
>
> > 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!
> > --
> > singeredel (Julie)