View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default how to suppress Invalid Merge Field prompt

I don't believe there is a way to suppress this dialog. It may be possible
to do it by trapping the appropriate Windows messages, (there is a similar
utility that supppresses Outlook's prompts during an e-mail merge -see
http://www.contextmagic.com/express-clickyes/ - it may even be owrth asking
them if they can do a version that solves this other probblem, /and/ the one
where a dialog pops up when Word can't find its data source).

[
FWIW, I suspect some people use code to try to compare the list of fields in
the merge document with the list of fields in the data source, but there are
some difficulties making it completely reliable, e.g.
a. because the messages can pop up even before you start a merge, it may
not be possible to open the mail merge main document without seeing the
dialog.
b. to avoid the message, you can consider opening a blank document and
inserting the mail merge main document into it. This kills the connection
with the mail merge data source, but
- the resulting document may not be the same
- unless you already know what data source the mail merge uses, by doing
that you lose the ability to inspect the list of fields in the data source
c. reliably finding all the fields in a document is non-trivial because it
is difficult, if not impossible, to iterate through absolutely all parts of
a document (some stuff in headers and footers may theoretically be missed.
However, documents with fields in such awkward places are probably the
exception rather than the rule.
d. Word truncates and modifies any long field field names in the data
source, so in theory you need to know how it does that in order to match
merge field field names to data source field names.
]

Peter Jamieson

"Francisc Molnar" wrote in
message ...
Hi all
If the datasource associated with the document does not contain columns
for
each field in the document, a prompt is shown: Invalid Merge Field, with
Remove, Cancel and OK buttons.
Is there a way to prevent this dialog from appearing ? or to provide a
default answer for it ?
I've already set Visible = false and DisplayAlerts =
WdAlertLevel.wdAlertsNone for the application.
thanks