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 / November 2007

Tip: Looking for answers? Try searching our database.

Macro language for filter

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ricki Miles - 10 Nov 2007 13:22 GMT
I am creating a Word XP macro to create an automated mail merge.  I need the
merge to happen only for reocords with an exact match to a certain field
(example DEPT = 3).  After I record the macro choosing to filter on the
field during the merge, the language in the macro does not mention the
nature of the match.  What is the proper macro language to make this happen?

TIA,

Ricki
Peter Jamieson - 13 Nov 2007 18:20 GMT
If you define a filter in the MailMerge Recipients dialog or its "advanced"
facility, Word actually "translates" your filter specifications into an SQL
SELECT statement. Precisely how it does it depends on which dialect of SQL
it thinks it needs to use. But toset up the filter in code,
a. find out the SQL that WOrd is using (e.g. look at the value of
ActiveDocument.MailMerge.DataSource.QueryString)
b. either set ActiveDocument.MailMerge.DataSource.QueryString to have the
value you need or
c. set the valuein a cal to OpenDataSource (you may have to do it this way
if you cannot use approach (b).

Signature

Peter Jamieson
http://tips.pjmsn.me.uk

>I am creating a Word XP macro to create an automated mail merge.  I need
>the merge to happen only for reocords with an exact match to a certain
[quoted text clipped - 6 lines]
>
> Ricki
 
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.