Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ahsan Rana
  Where is Ahsan Rana?
 Lahore
 Pakistan
 Ahsan Rana
 To: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 Tags
Subject: RE: Office Automation
Thread ID: 209577 Message ID: 209625 # Views: 1 # Ratings: 0
Version: Visual FoxPro 7 Category: Forms
Date: Tuesday, December 30, 2008 6:01:31 AM         
   


> > Hi Experts
> >
> > Is it possible to send a Letter designed in MS Word to No. Of Customers from VFP Menu. RTF is a solution to do this but I want send Word designed letter. So Plewase help me.
> >
> > Rgds:
> > Ahsan Rana
>
> You can use Mailmerge feature of word. ie:
>
>
Select * From customer Into Cursor mergethese
> MergeIt('mergethese')
> 
> Function MergeIt
> 	Lparameters  tcAlias, tcTemplateDoc
> 	Local nLocaleID,lcTemp,lcHeader
> 	Local loWord,llToPrinter,lcSourceDoc
> 
> 	*** set the LOCALEID to English
> 	nlLocaleId=Sys(3004)  && Save local id
> 	=Sys(3006,1033)       && We will be sending instructions in English
> 	*** set the LOCALEID to English
> 
> 	* Prepare source
> 	Select (m.tcAlias)
> 	lcTemp = Sys(2015)+'.tmp'
> 	Copy To (lcTemp) Type Delimited With "" With Tab
> 	Afields(laFields)
> 	lcHeader = ''
> 	For ix = 1 To Fcount()
> 		lcHeader = lcHeader + ;
> 			Iif(Empty(m.lcHeader),'',Chr(9)) + ;
> 			Field(m.ix)
> 	Endfor
> 	lcSourceDoc = Sys(5)+Curdir()+'MergeSource.txt'
> 	Strtofile(m.lcHeader+Chr(13)+Chr(10)+Filetostr(m.lcTemp),m.lcSourceDoc)
> 	Erase (m.lcTemp)
> 
> 	loWord=Createobject("word.application")	&& Create word object
> 	With loWord
> 		If Empty(m.tcTemplateDoc) && No template
> 			.documents.Add()  && New file
> 		Else
> 			.documents.Add(m.lcTemplateDoc)  && Open a template
> 		Endif
> 		With .Activedocument.Mailmerge
> 			.OpenDataSource(m.lcSourceDoc) && Set file as data source for mailmerge
> 			.EditMainDocument	&& Activate the main document
> 
> 			* Just to sample programmatic writing
> 			.Application.Selection.TypeText("Company : ")
> 			.Fields.Add(.Application.Selection.Range,'company')
> 			.Application.Selection.TypeText(Chr(13)+"Dear contact : ")
> 			.Fields.Add(.Application.Selection.Range,'contact')
> 			.Application.Selection.TypeText(Chr(13)+"Blah blah ...."+Chr(13))
> 			* Just to sample programmatic writing
> 			*!*	FOR EACH oFld IN .Fields
> 			*!*	? GETWORDNUM(oFld.Code.Text,2)
> 			*!*	endfor
> 		Endwith
> 		.Visible = .T.  && Show word app
> 		.Activate  && Make it the active foreground app
> 	Endwith
> 
> 	**** Set the LocaleId to the previous value
> 	=Sys(3006,Val(nlLocaleId))
> 

>
> Cetin Basoz


Thnx Cetin

I want to Print Doc through VFP not to design thru VFP. User will design a letter either from VFP or out side VFP and Save it any location. Afterward I want to print letter to selected customers, addresses from VFP Table and Text of Doc Letter.

Rgds:
Ahsan Rana

ENTIRE THREAD

Office Automation Posted by Ahsan Rana @ 12/29/2008 5:43:40 PM
RE: Office Automation Posted by Anders Altberg @ 12/29/2008 5:57:50 PM
RE: Office Automation Posted by Ahsan Rana @ 12/29/2008 6:42:14 PM
RE: Office Automation Posted by Anders Altberg @ 12/30/2008 1:31:09 PM
RE: Office Automation Posted by Biju Thomas @ 12/30/2008 3:13:41 AM
RE: Office Automation Posted by Anders Altberg @ 12/30/2008 12:56:46 PM
RE: Office Automation Posted by Cetin Basoz @ 12/29/2008 7:09:42 PM
RE: Office Automation Posted by Ahsan Rana @ 12/30/2008 6:01:31 AM
RE: Office Automation Posted by Cetin Basoz @ 12/30/2008 2:28:03 PM
RE: Office Automation Posted by Yousfi Benameur @ 12/29/2008 10:36:49 PM
RE: Office Automation Posted by Biju Thomas @ 12/30/2008 3:23:16 AM
RE: Office Automation Posted by Yousfi Benameur @ 12/30/2008 2:04:47 PM
RE: Office Automation Posted by Ahsan Rana @ 12/30/2008 5:48:52 AM
RE: Office Automation Posted by Yousfi Benameur @ 12/30/2008 2:15:45 PM
RE: Office Automation Posted by Ahsan Rana @ 12/31/2008 5:55:57 AM
RE: Office Automation Posted by Anders Altberg @ 12/30/2008 5:06:44 PM
RE: Office Automation Posted by Ahsan Rana @ 12/31/2008 5:53:31 AM
RE: Office Automation Posted by Yousfi Benameur @ 12/30/2008 2:00:54 PM
RE: Office Automation Posted by Cetin Basoz @ 12/30/2008 3:52:57 PM
RE: Office Automation Posted by Yousfi Benameur @ 12/30/2008 6:30:56 PM
RE: Office Automation Posted by Ahsan Rana @ 1/1/2009 6:37:54 AM