Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Merge Question ABC Button..
Message
 
To
19/04/2008 17:46:54
Chris Sund
Silhouette Solutions
Utah, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Miscellaneous
Thread ID:
01311708
Message ID:
01311928
Views:
23
>Hi Borislav,
>
>Here's the chunk of code that actually does the merge...
>
>
>
>
>
>
>
>oWord = Createobject("Word.Application")
>		oWord.Visible = .T.
>
>
>
>		oDoc = oWord.Documents.Open(Curdir()+"form_letters\"+pdocument)
>		oDoc.MailMerge.MainDocumentType = 0
>		oDoc.MailMerge.OpenDataSource(lcSourceDoc)
>
>*!*			oDoc.MailMerge.Datasource.FirstRecord =  oDoc.MailMerge.Datasource.ActiveRecord
>*!*			oDoc.MailMerge.Datasource.LastRecord = oDoc.MailMerge.Datasource.ActiveRecord
>
>
>		oDoc.Activate && Make it the active foreground app
>		oWord.ActiveDocument.ActiveWindow.View.ShowFieldCodes = .F.
>
>
>
>
>I hope that helps.
oWord = Createobject("Word.Application")
oWord.Visible = .T.

oDoc = oWord.Documents.Open(Curdir()+"form_letters\"+pdocument)
oDoc.MailMerge.MainDocumentType = 0
oDoc.MailMerge.OpenDataSource(lcSourceDoc)

oDoc.MailMerge.Datasource.FirstRecord =  oDoc.MailMerge.Datasource.ActiveRecord
oDoc.MailMerge.Datasource.LastRecord = oDoc.MailMerge.Datasource.ActiveRecord

oDoc.MailMerge.EditMainDocument
oDoc.MailMerge.Destination = 0           && File
oDoc.MailMerge..Execute(.t.)             && Merge to new file
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform