Pythonwin - Word automation - Removing watermark not working

Gregory Piñero gregpinero at gmail.com
Fri Nov 4 22:13:45 CET 2005


Is there a different group/mailing list I should try? Does anyone know if
there is a pythonwin group/list for example?


On 11/3/05, Gregory Piñero <gregpinero at gmail.com> wrote:
>
> I thought I'd take a shot and see if anyone knows the answer to this? I've
> been stuck for a while now on this.
>
> Would anyone happen to know why this my function removewatermark() in this
> code isn't working? I copied it from a Word macro I recorded and it did work
> when I recorded the macro. When I run it the watermark doesn't go away.
>
> I've also attached the code in case the formatting gets messed up from the
> email.
>
>
> <code>
> import sys
> import os
> from win32com.client import gencache, constants
> WORD='Word.Application'
> False,True=0,-1
>
> class Word:
> def __init__(self):
> self.app=gencache.EnsureDispatch(WORD)
> self.app.Visible = 1
> self.app.DisplayAlerts = 0
> def open(self,doc):
> self.app.Documents.Open(FileName=doc)
> def removewatermark(self):
> self.app.ActiveDocument.Sections(1).Range.Select()
> self.app.ActiveWindow.ActivePane.View.SeekView = 9 #
> wdSeekCurrentPageHeader
> self.app.Selection.HeaderFooter.Shapes
> ("PowerPlusWaterMarkObject1").Select()
> self.app.Selection.Delete()
> self.app.ActiveWindow.ActivePane.View.SeekView = 0 #wdSeekMainDocument
> </code>
>
>
> Thanks,
>
> Greg
>
> --
> Gregory Piñero
> Chief Innovation Officer
> Blended Technologies
> (www.blendedtechnologies.com <http://www.blendedtechnologies.com>)
>



--
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com <http://www.blendedtechnologies.com>)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051104/e8775d71/attachment.html>


More information about the Python-list mailing list