Printing Word with OLE

From: <kasia2011_at_my-deja.com>
Date: Mon, 31 May 1999 15:10:45 GMT
Message-ID: <7iu8pl$gje$1_at_nnrp1.deja.com>



Hi,

I have to manipulate Word97 documents from Forms 4.5 using ole2. I do this :

  • Using the 'OpenDataSource' propert of the 'MailMerge' object coll_merge := ole2.GET_OBJ_PROPERTY(document2,'MailMerge'); arglist := ole2.CREATE_ARGLIST; ole2.ADD_ARG(arglist,'filename'); ole2.ADD_ARG(arglist,0); -- Format ole2.ADD_ARG(arglist,0); -- ConfirmConversions ole2.ADD_ARG(arglist,0); -- ReadOnly ole2.ADD_ARG(arglist,0); -- LinkToSource ole2.ADD_ARG(arglist,0); -- AddToRecentFiles ole2.ADD_ARG(arglist,''); -- PasswordDocument ole2.ADD_ARG(arglist,''); -- PasswordTemplate ole2.ADD_ARG(arglist,0); -- Revert ole2.ADD_ARG(arglist,''); -- WritePasswordDocument ole2.ADD_ARG(arglist,''); -- WritePasswordTemplate ole2.ADD_ARG(arglist,''); -- Connection ole2.ADD_ARG(arglist,''); -- SQLStatement ole2.ADD_ARG(arglist,''); -- SQLStatement1 ole2.INVOKE(coll_merge,'OpenDataSource',arglist); ole2.DESTROY_ARGLIST(arglist);
  • Setting the properties of merge ole2.SET_PROPERTY(coll_merge,'Destination',1); -- 1 = wdSendToPrinter ole2.SET_PROPERTY(coll_merge,'SuppressBlankLines',1);
  • Using the function 'Execute' ('MailMerge' object) arglist := ole2.CREATE_ARGLIST; ole2.ADD_ARG(arglist,1); ole2.INVOKE(coll_merge,'Execute',arglist); ole2.DESTROY_ARGLIST(arglist);

When I execute this code I have to acknowledge the Print action. I would like to render this transparent for the user. How to do that?

n.b. The VB code for this would be :

Dim MyMerge as MailMerge
Set MyMerge = ActiveDocument.MailMerge
If MyMerge.State = wdMainAndDataSource Then

	SendKeys "{enter}"
	With ActiveDocument.MailMerge

.Destination = wdSendToPrinter
.Execute
End With
End If

Translation in OLE????????????

Thanks for your help.

Kasia

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Mon May 31 1999 - 17:10:45 CEST

Original text of this message