FW: [Zope] m$ word question

Greg Conway greg@gmlnt.com
Fri, 26 Jul 2002 01:13:52 +0100


Hi all (especially Oliver if you are there!!)

>> >> But if you know how to invoke the WORD-object from Python -
>> >> which should be
>> >> a piece of cake
>> >> Then you only need the stream of data and voila.

Can anybody please help me with the above? Maybe someone has some example
code they could (please please please!) throw my way so I can get a starting
point on this!!

Maybe a piece of cake to some, but I am still struggling!

Do I need to initalise COM to do this? (at the bottom of this mail)

I am running Zope 2.5.0 - is COM already enabled in Zope by this release by
default?

Many thanks for any help!

Regards,

Greg Conway.


PS the VB code I actually want to run is as follows! if anybody else can
throw some light on this from my code, would be very very appreciated!


    Dim objWord As Word.Document
    Set objWord = GetObject(Template, "Word.Document")

    FullPath = FolderName & "\" & Filename

    ' Make Word visible.
    objWord.Application.Visible = True

    ' Set the mail merge data source
    objWord.MailMerge.OpenDataSource _
            Name:="H:\ENACT\Datatables\nacustdb-010_be.MDB", _
            LinkToSource:=True, _
            Connection:="TABLE CustDetail", _
            SQLStatement:="SELECT * FROM [CustDetail] WHERE CustNoD=" &
ContractID

    ' Execute the mail merge.
    objWord.MailMerge.Execute

    ' Set the path and save the current document
    objWord.Application.ActiveDocument.SaveAs Filename:=FullPath



>> -----Original Message-----
>> From: Greg Conway [mailto:greg@gmlnt.com]
>> Sent: 25 July 2002 07:15
>> To: oliver@tekk.dk
>> Subject: RE: [Zope] m$ word question
>>
>>
>> Hi Oliver,
>>
>> This sounds as if it is exactly what I need to do!
>>
>> However, whilst I have my VB code I have not a clue where to
>> start with Zope!
>>
>> You don't possibly have a bit of example code you could throw my
>> way, please, that I could maybe get a starting point from?!
>>
>> Many thanks!
>>
>> Regards,
>>
>> Greg.
>>
>> >> -----Original Message-----
>> >> From: Oliver Marx [mailto:oliver@tekk.dk]
>> >> Sent: 22 July 2002 09:35
>> >> To: Toby Dickenson; Greg Conway; Zope@Zope. Org
>> >> Subject: RE: [Zope] m$ word question
>> >>
>> >>
>> >> The VB-script is already based on COM.
>> >> So doing COM communication twice is not good coding style in
>> my opinion.
>> >>
>> >> But if you know how to invoke the WORD-object from Python -
>> >> which should be
>> >> a piece of cake
>> >> Then you only need the stream of data and voila.
>> >>
>> >> \Oliver
>> >>
>> >> >>-----Original Message-----
>> >> >>From: zope-admin@zope.org [mailto:zope-admin@zope.org]On
>> Behalf Of Toby
>> >> >>Dickenson
>> >> >>Sent: 22. juli 2002 10:09
>> >> >>To: Greg Conway; Zope@Zope. Org
>> >> >>Subject: Re: [Zope] m$ word question
>> >> >>
>> >> >>
>> >> >>On Saturday 20 Jul 2002 1:02 am, Greg Conway wrote:
>> >> >>
>> >> >>> Anyway, what I want to do exactly is call Word with a stream
>> >> of data, to
>> >> >>> perform a Mail Merge. I'm converting some script that
>> already runs in
>> >> >>> Visual Basic, is it possible to get a Visual Basic script
>> >> >>plug-in for Zope?
>> >> >>
>> >> >>Youve already got some code? thats a good start. Use VB to wrap
>> >> >>it up in an
>> >> >>in-process COM object, and use python's COM support in an
>> >> >>external method to
>> >> >>call it.
>> >> >>
>> >> >>The one major gotcha is getting COM initialized correctly. Unless
>> >> >>you add some
>> >> >>code, this will happen wrong by default. One of these should help:
>> >> >>
>> >> >>http://www.google.com/search?q=dickenson+coinitializeex
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>_______________________________________________
>> >> >>Zope maillist  -  Zope@zope.org
>> >> >>http://lists.zope.org/mailman/listinfo/zope
>> >> >>**   No cross posts or HTML encoding!  **
>> >> >>(Related lists -
>> >> >> http://lists.zope.org/mailman/listinfo/zope-announce
>> >> >> http://lists.zope.org/mailman/listinfo/zope-dev )
>> >> >>---
>> >> >>Incoming mail is certified Virus Free.
>> >> >>Checked by AVG anti-virus system (http://www.grisoft.com).
>> >> >>Version: 6.0.371 / Virus Database: 206 - Release Date: 13-06-2002
>> >> >>
>> >> ---
>> >> Outgoing mail is certified Virus Free.
>> >> Checked by AVG anti-virus system (http://www.grisoft.com).
>> >> Version: 6.0.371 / Virus Database: 206 - Release Date: 13-06-2002

This electronic transmission and any files attached to it are strictly
confidential and intended solely for the addressee. If you are not
the intended addressee, you must not disclose, copy or take any action
in reliance of this transmission. If you have received this
transmission in error, please notify us by return and delete the same.
Further enquiries/returns can be posted to postmaster@gmlnt.com
Thank you.