Bug? {Nested {ADDIN} field} .Data scrambled!

A

alainr

I use Word 2002, and was refering to point #3 of:

http://word.mvps.org/FAQs/TblsFldsFms/UsingMacroButton.htm

I was trying to use the {Addin} field inside another field such as:

{REF BookmarkName {ADDIN}}

I then select the {ADDIN} field and assign a value to its "Data" property
using VBA:

Selection.Fields(1).Data = "Test String."

I can then confirm with the VBA locals window that the "Data" field property
of the "Addin" field was properly set.

However, once I select the entire nest field set, or group of fields, and
perform an "Update Field", the value of the "Data" property of the {Addin}
field gets all scrambled!?

This does not happen if the {Addin} field is stand-alone (not nested within
another field).

Does anyone know if this is a bug, if this happens in MS Word 2003 or know
of a workaround for Word 2002?
 
J

Jean-Guy Marcil

alainr was telling us:
alainr nous racontait que :
I use Word 2002, and was refering to point #3 of:

http://word.mvps.org/FAQs/TblsFldsFms/UsingMacroButton.htm

I was trying to use the {Addin} field inside another field such as:

{REF BookmarkName {ADDIN}}

I then select the {ADDIN} field and assign a value to its "Data"
property using VBA:

Selection.Fields(1).Data = "Test String."

I can then confirm with the VBA locals window that the "Data" field
property of the "Addin" field was properly set.

However, once I select the entire nest field set, or group of fields,
and perform an "Update Field", the value of the "Data" property of
the {Addin} field gets all scrambled!?

This does not happen if the {Addin} field is stand-alone (not nested
within another field).

Does anyone know if this is a bug, if this happens in MS Word 2003 or
know of a workaround for Word 2002?

I am not sure if it is a bug... I mean, what would be the purpose of an
ADDIN field in a REF field?

IF you use the ADDIN field in a MACROBUTTON field (As suggested in the
http://word.mvps.org/FAQs/TblsFldsFms/UsingMacroButton.htm
article) then everything works as expected.

If you update the MACROBUTTON field, the ADDIN value is retained, if you
update an ADDIN field on its own, the value is also retained.
The problem you have observed seems to be with a REF field; but keep in mind
that REF fields do not accept any other nested field.

Try this:

Create a MACROBUTTON field, and at the end, add a QUOTE field:
{MACROBUTTON TestMacro1 Click {QUOTE New Text}}
and do the same with a REF field:
{REF BookName {QUOTE New Text}}

Now update all your fields.
Just to make sure, display field codes (ALT-F9), change the value of the
QUOTE field to "New Text", re-do ALT-F9, update all the fields.

See that the value of the QUOTE field is never displayed in the REF field.
For that reason, I do not think it is a bug.

So, again, what were you trying to do with an ADDIN field in a REF field?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
A

alainr

The problem you have observed seems to be with a REF field; but keep in mind
that REF fields do not accept any other nested field.

Ahh! That's good to know. Is this mentionned anywhere?
Create a MACROBUTTON field, and at the end, add a QUOTE field:
{MACROBUTTON TestMacro1 Click {QUOTE New Text}}
and do the same with a REF field:
{REF BookName {QUOTE New Text}}
Now update all your fields.
See that the value of the QUOTE field is never displayed in the REF field.
For that reason, I do not think it is a bug.

I see. However, I never came across any explicit detail on the limitations
of "nested" fields in word.
So, again, what were you trying to do with an ADDIN field in a REF field?

I was trying to "Tag" particular REF fields using the Data property of
{Addin}. I needed to have some kind of unique identifier for each REF field
even if they point to the same bookmark (hence are identical). For example,
to assign metadata to along with the REF field's occurance for further
processing, or to be able to programatically change the bookmark name of a
particular REF occurance, at a later time.

I will now change my approach tu use a MacroButton instead of a
Cross-Refererence.

Many thanks for the help,
 
J

Jean-Guy Marcil

alainr was telling us:
alainr nous racontait que :
Ahh! That's good to know. Is this mentionned anywhere?

Not that I know of.
I should be less dogmatic about this. Let me rephrase:
As far as I know, in my experience, I have never been able to use other
fields value inside a REF field to change the REF field value/result.
In fact, if your bookmark name are unique and do not clash with other field
names, the "REF" in the REF field is optional:
{REF MyBookMarkName}
will display the same as
{MyBookMarkName}
I see. However, I never came across any explicit detail on the
limitations of "nested" fields in word.

You are right, there aren't many. Among other places, if you look up the IF
field in the online help, there are examples of nested fields.
I was trying to "Tag" particular REF fields using the Data property of
{Addin}. I needed to have some kind of unique identifier for each
REF field even if they point to the same bookmark (hence are
identical). For example, to assign metadata to along with the REF
field's occurance for further processing, or to be able to
programatically change the bookmark name of a particular REF
occurance, at a later time.

I will now change my approach tu use a MacroButton instead of a
Cross-Refererence.

You can still use your REF fields, but not with a DATA field:

{REF MyBookMark {PRIVATE UniqueIdentifier}}
or
{MyBookMark {PRIVATE UniqueIdentifier}}

should do what you want.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
A

alainr

You can still use your REF fields, but not with a DATA field:
{REF MyBookMark {PRIVATE UniqueIdentifier}}
or
{MyBookMark {PRIVATE UniqueIdentifier}}

Good idea, I will try that instead. Many Thanks
 

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