how long is empty field in Word

M

maryFlower

Microsoft Office 2002 sp3
after merging a document I want to delete empty fileds. Any field that is
empty should be delete by the macro
 
D

Doug Robbins

There are no mergefields in a document produced by executing a merge.
Hence, there should really be nothing to delete.


--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 
M

maryFlower

I am using a third party product to merge data from Lotus notes to a word
document and it definatly leaves the fields behind.
 
J

Jean-Guy Marcil

maryFlower was telling us:
maryFlower nous racontait que :
I am using a third party product to merge data from Lotus notes to a
word document and it definatly leaves the fields behind.

Select one of those empty fields, do SHIFT-F9.
Post the field code you see.

If you do not see any code, do ALT-F9, and post what you see in place of the
field.

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

maryFlower

«SUBSECTIONBODY1»

This is what is left behind after the merge
Thanks

Maryflower
 
J

Jean-Guy Marcil

maryFlower was telling us:
maryFlower nous racontait que :
«SUBSECTIONBODY1»

This is what is left behind after the merge

You mean that you have a bunch of
{SUBSECTIONBODY1}
fields? Field codes are always between a pair of {}, make sure you see those
{} when you report the content of the field code (not the same as using the
mailmerge tool bar button to toggle field code and field value.

Did you get that from doing SHIFT-F9 (Was the SHIFT-F9 successful?) or did
you have to resort to ALT-F9 to get that to display?

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

Jean-Guy Marcil

Jean-Guy Marcil was telling us:
Jean-Guy Marcil nous racontait que :
maryFlower was telling us:
maryFlower nous racontait que :


You mean that you have a bunch of
{SUBSECTIONBODY1}
fields? Field codes are always between a pair of {}, make sure you
see those {} when you report the content of the field code (not the
same as using the mailmerge tool bar button to toggle field code and
field value.
Did you get that from doing SHIFT-F9 (Was the SHIFT-F9 successful?)
or did you have to resort to ALT-F9 to get that to display?

I have never seen a merge from a data source yield fields that are all of
the same type. This third party application is doing something I have never
seen.
In any case, try this on a copy of your document:

'________________________________
Dim MyField As Field

For Each MyField In ActiveDocument.Fields
If Trim(MyField.Result = "") Then
MyField.Delete
End If
Next
'________________________________

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

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