Wildcard search does not work on Mail Merge Fields (MS Word)

M

Maximus

I wonder whether anyone ran into this issue before - I spend a dozen of
hours but could not figure out.

I am writing a Word AddIn in C++. The AddIn is to convert anything between <
and >. It works just fine for plain text, but does not work on Mail Merge
fields.

For example, '<Jane>' worked if I typed it, but if the same 'Jane' came from
a mail merge field, it did not find the match.

I thought that some code is incorrect, but the same thing happended when I
use the Find in Word.

The wildcard to search is \<*>.

However, searching plain text (such as 'Jane') in mail merge fields works
just fine.

For example,

<Joilet Smith
142 Main Street
Milbrae CA, 91786
USA>

The piece of text above contains 6 merge fields, with < and > manually
typed. If I copy the whole thing to paste into document as plain text, both
my Add-In and find (in Word) work fine on pasted plain text, but not the
merge field block.
 
M

macropod

Hi Maximus,

I suspect your search isn't working on the mergefields because they don't actually hold the data you're looking for - the data are
still in the source file, not the mailmerge main document. Although you can scroll through the merge records before executing the
merge, the Find will 'see' the mergefield code, not the reference data. Once you've executed the merge, the mergefields are replaced
by the corresponding records from the data source, and the Find can 'see' what's been output.

BTW, mergefields are delimited by markers that *appear* as «» or {}, depending on whether you've got the field code displayed. Also,
if you're using wildcards to search strings delimited by <>, the syntax is \<*\>.
 
D

DJay

I too am having a problem with wildcards. I am using Access 2007 and Word
2007. The fieldnames DO get properly inserted in the document, only the
values are empty. My query, using like "xyz*" works in Access, but in my Word
mailmerge, the recipient list (from the query) is empty. This operation
worked fine in Office 2003. Both the DB and the Word file were created in
Office 2007.
If I change my query to use % and _ instead of * and ?, it all works, but I
don't want to use the old ANSI 92 wildcards. Any idea what I cna do to make
the new wildcards work?
regards,
DJ
 

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