Logically deleted mergefield

T

Tony Bradford

I have encountered a mail merge error, in which the error refers to a
missing mergefield in the data stream. On examination this data field is not
visible in word via the find command, however if the "template" is opened up
in notepad the field name can be seen.

Excerpt from template

....mergefield O01_SUB_PMT_DTE1 \@"MMMM> yyyy"January" " mergefield
MRTG_PMT_DUE_DY \* Ordinal31st > mergefield O01_SUB_PMT_DTE1 \@"MMMM
yyyy"January" mergefield> MRTG_PMT_DUE_DY \* Ordinal31st  mergefield
EFF_DATE_4 \@"MMMM> yyyy"January 2004" mergefield MRTG_PMT_DUE_DY \*
Ordinal31st > mergefield EFF_DATE_4 \@"MMMM yyyy"January 2004"
mergefield> MRTG_PMT_DUE_DY \* Ordinal31st  mergefield EFF_DATE_4
\@"MMMM> yyyy"January 2004"30th  mergefield 01_SUB_PMT_DTE1 \@"MMMM>
yyyy"April 2003"30th 

The offending field in the above excerpt is EFF_DATE_4.

What appears to have happened is that this field was once used and was
deleted, but it appears that the template has held on to the reference. What
I am looking for is someway of cleaning up the template without having to
revert to manual cut & paste techniques.

Thank you

Tony Bradford
 
C

Cindy M -WordMVP-

Hi Tony,

You did look at the template with Alt+F9 to see the actual field codes (not
just the result display or preview, but the real codes)?

What I have seen before is that a field code gets nested into a the bracket of
another field code. You can't see that, but Word (and often VBA) does. One
thing you could try would be to delete the two merge fields either side of it.
If this is what happened, this should clear it out of the document (you'd need
to recreate these two merge fields, of course).
I have encountered a mail merge error, in which the error refers to a
missing mergefield in the data stream. On examination this data field is not
visible in word via the find command, however if the "template" is opened up
in notepad the field name can be seen.

Excerpt from template

....mergefield O01_SUB_PMT_DTE1 \@"MMMM> yyyy" January " " mergefield
MRTG_PMT_DUE_DY \* Ordinal 31st > mergefield O01_SUB_PMT_DTE1 \@"MMMM
yyyy" January " mergefield> MRTG_PMT_DUE_DY \* Ordinal 31st mergefield
EFF_DATE_4 \@"MMMM> yyyy" January 2004 " mergefield MRTG_PMT_DUE_DY \*
Ordinal 31st > mergefield EFF_DATE_4 \@"MMMM yyyy" January 2004 "
mergefield> MRTG_PMT_DUE_DY \* Ordinal 31st mergefield EFF_DATE_4
\@"MMMM> yyyy" January 2004 " 30th mergefield 01_SUB_PMT_DTE1 \@"MMMM>
yyyy" April 2003 " 30th

The offending field in the above excerpt is EFF_DATE_4.

What appears to have happened is that this field was once used and was
deleted, but it appears that the template has held on to the reference. What
I am looking for is someway of cleaning up the template without having to
revert to manual cut & paste techniques.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
T

Tony Bradford

Hi Cindy,

I have viewed the template in both modes (ie toggled Alt-F9) and in both
case the offending merge field is not visible.
I am trying to aviod manually amending the template as we have over 200
templates to investigate, The software we are using is changing from using
word directly to using "Word libraries" (I assume it is calling the dll or
equivalent directly) which has caused this problem to occur.

I am interested in how VBA access these merge fields - have you any sample
code?

Many Thanks

Tony Bradford
 
C

Cindy M -WordMVP-

Hi Tony,
I have viewed the template in both modes (ie toggled Alt-F9) and in both
case the offending merge field is not visible.
If it's field corruption, as I'm beginning to suspect, then you will NEVER
be able to see these. Nor will you be able to "extract" them. Your only
choice will be to completely replace the "broken" field.

When I said VBA can "see" them, I meant if you do a For Each field in
doc.Fields VBA will pick them up. But it can't manipulate (delete) them. At
least, not that I've ever found. The structure isn't what it's supposed to
be, and the internal tables that manage these things are damaged.

But this is all speculation until you actually try what I advised in my last
message to see if that is really what's going on.
I am trying to aviod manually amending the template as we have over 200
templates to investigate, The software we are using is changing from using
word directly to using "Word libraries" (I assume it is calling the dll or
equivalent directly) which has caused this problem to occur.

I am interested in how VBA access these merge fields - have you any sample
code?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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