help me about mail merge..

seductive

Member
hi everyone until now i have a problem about mail merge..
please give me an code snippet using webspeed..
how do i read the template in the server??

this program works on gui.. but in webspeed is not working..

DEFINE VARIABLE chWordApp AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chDoc AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chMerge AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chNewDoc AS COM-HANDLE NO-UNDO.

&GLOBAL-DEFINE wdSendToNewDocument 0

CREATE "Word.Application" chWordApp.
chWordApp:ScreenUpdating = TRUE.
chWordApp:visible = FALSE.
chWordApp:displayAlerts = FALSE.

/* open the template document */
chDoc = chWordApp:documents:OPEN("c:\MergeTemplate.doc",,YES,FALSE).

/* set Mail Merge object */
chMerge = chDoc:MailMerge.

/* open the data source */
chMerge:OpenDataSource("c:\MergeData.txt").
chMerge:SuppressBlankLines = FALSE.

/* merge target is a NEW word Doc */
chMerge:Destination = {&wdSendToNewDocument}.

/* Run merge */
chMerge:EXECUTE.

/* get handle to new document (the merged one) */
chNewDoc = chWordApp:ActiveDocument.
chNewDoc:fields:update.
chWordApp:visible = TRUE.

RELEASE OBJECT chDoc.
RELEASE OBJECT chMerge.
RELEASE OBJECT chNewDoc.
RELEASE OBJECT chWordApp.


did i miss something?? please help me..
 

Stefan

Well-Known Member
1. What error?
2. since WebSpeed is running in batch mode I'm not sure if all the :Visibles are of any use
3. What Progress version?
4. Running r-code or source code?
5. can the account your WebSpeed agent is running on get to all the required bits?
 

seductive

Member
hi sir stefan, when im using it in the procedure using gui its running. but when i transfer the code in webspeed nothing happens. im using 10.1b, running at r-code...
 

RealHeavyDude

Well-Known Member
You do not reveal essential information as to advice you ...

What version of Progress/OpenEdge is this?
On what OS is the WebSpeed Broker running?
How do you call the procedure on the WebSpeed Broker?

Usually OLE automation objects are integrated in Progress with some sort of input blocking. This will never work the same way in a batch process as it would in a interactive GUI client. Therefore I strongly suggest you the re-think your design. GUI procedures will never run 1:1 in a batch session.

You could begin with telling us the error message you get - if any. Did you have a look in the log file of the WebSpeed Broker's agents?

Heavy Regards, RealHeavyDude.
 

Stefan

Well-Known Member
To remove WebSpeed from the equation, what happens when you run the r-code using _progres with -b ?

Code:
%DLC%\bin\_progres.exe -b -p yourfile.r > c:\temp\yourfile.log
 
Top