Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mailmerge with VFP & Word 97
Message
De
01/04/1999 04:10:09
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00203401
Message ID:
00204149
Vues:
17
>Hello All,
>
>I know there have been numerous threads here on U.T. concerning Word/Foxpro mailmerges, but I can't seem to find an answer to my problem ( I've tried various drugs ), I need to create a data source for a predefined Word mailmerge document, and initiate the mailmerge process from within VFP allowing user intervention from within Word, from what I've gleaned from the previous threads the process would be:
>
>1) Run a VFP Query thus creating a table.
>2) Start Word using Automation. ( ok so far ).
>3) Open mailmerge document ( how? )
>4) Print letters ( how? )
>5) If letter printed ok set flag on table ( ok on this ).
>
>any help gratefuly received
>
>Regards
>
>
>Pete Kane.
Hi Pete,
In files\classes section there is a mailmerge class. It has only one method mailmerge. What it does is fairly simple and this is its commentation :
lparameters tcSQL, tcTemplate, tnDestination, tlShow, tlWaitWordFinish
* Calling : thisform.mmerge(tcSQL [[, tcTemplate][, tnDestination][, tlShow] [,tlWaitWordFinish]])
* Parameters
*!*	tcSQL			- SQL for mailmerge data  w/o destination. 
*!*				ie: [select * ]+;
*!*				[from (home()+"SAMPLES\DATA\employee") ]+;
*!*				[where title = "Sales"]
*!*	tcTemplate		- Optional. If specified tcTemplate will be used as template doc.
*!*	tnDestination	- Optional. Default none. None, Doc or Printer (0,1,2).
*!*	tlShow		- Optional. Default show (.t.). ie: with tnDestination 2 and tlShow .f.
*!*	just prints and exists. .f. requires tcTemplate specified.
*!*	When destination is not 2 (printer) tlShow is ignored.
*!*	tlWaitWordFinish- Optional. Default (.t.). If .f. execution continues.
*!*	Sample calls :
*!*	1-Select all fields from current alias and show new document ready with merge fields.

*!*	thisform.mmerge([select * from (alias())])

*!*	2-Select all fields from home()+"samples\data\employee" where title like "Sales%"
*!*	and print using "c:\Temp\myTemplate.doc", do not show word window at all.
*!*	thisform.mmerge([select * from (home()+"SAMPLES\DATA\employee") ]+;
*!*		[where title like "Sales%" ] ,;
*!*		"c:\Temp\myTemplate.doc" , 2, .F.)
As you can see all you do is to supply an SQL and optionally a template. As in last sample calling, you can define an SQL + a template and get printout w/o showing a word window. If you want to build template on the fly then you use "insertmergefield(cMergeFieldName)".
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform