win32com.client.constants - AttributeError

Roger Upole rupole at hotmail.com
Thu Apr 20 23:33:43 EDT 2006


The constants are only available if you've run makepy on the
Word object library.

       Roger

"kbperry" <keith.b.perry at gmail.com> wrote in message news:1145565829.143096.75510 at e56g2000cwe.googlegroups.com...
> On my machine, this runs fine, but when I try to run it on someone
> elses machine it blows up with an attribute error:
>
> <code>
> import win32com.client, pythoncom
>
> pythoncom.CoInitializeEx(pythoncom.COINIT_APARTMENTTHREADED)
> myWord = win32com.client.dynamic.Dispatch ("Word.Application")
> myWord.Visible = True
> myDoc = myWord.Documents.Open(FileName= "C:\Test.doc")
> myDoc .SaveAs(FileName = "c:\Test.htm", FileFormat =
> win32com.client.constants.wdFormatHTML)
>
> myDoc.Saved=1
> myWord.Quit ()
>
> del myWord
> pythoncom.CoUninitialize()
> </code>
>
> It's pretty simple code so I don't understand why it doesn't work.  I
> verified that he has the same pywin32 module as me (build 207) and the
> same python version (2.4.2).
>
> Any ideas?
> 




----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---



More information about the Python-list mailing list