Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / August 2007

Tip: Looking for answers? Try searching our database.

Trigger a find/replace on mail merge?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George Adams - 15 Aug 2007 21:23 GMT
I'm trying to make a directory, pulling in data from an ODBC database to
make a mail merge.  For simplicity, let's just say the template looks
like this:

    { MERGEFIELD "lastname"}, { MERGEFIELD "firstname" }

All well and good.  The only problem is that the database stores any
special characters as HTML entities (since the DB is primarily used for
displaying the directory on the web).  Thus, the accent characters in
Jose Pinera (over the "e" in "Jose" and "n" in "Pinera") are stored in
the database as:

     lastname: Piñera
    firstname: José

Now, there are only a few of these, so a few search/replace commands
should be able to convert the HTML entities back into the actual
letters.  I can't figure out how to incorporate this into the mail
merge, though.  Is it possible to setup my document such that, with a
single push, the mail merge can run and a find/replace function can go
through "lastname" and "firstname", replacing all the HTML entities I
specify with their actual (ISO-8859-1) characters?

Thanks to anyone who can help!
Peter Jamieson - 15 Aug 2007 21:50 GMT
If you record a Word macro that merges to an output document, you can then
modify that macro so that it also does a number of find/replace operations
on the output document. All you really need to know is that when the merge
is complete, the output document is the ActiveDocument (if you need to do
things to the Mail Merge Main DOcument post-merge, make a reference to it
before you execute the merge).

You'll probably find plenty of samples of  find/replace VBA code in the
word.vba newsgroups here, and probably at http://word.mvps.org as well.

Peter Jamieson
> I'm trying to make a directory, pulling in data from an ODBC database to
> make a mail merge.  For simplicity, let's just say the template looks
[quoted text clipped - 20 lines]
>
> Thanks to anyone who can help!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.