win32com.client.constants - AttributeError

2006-04-20 Thread kbperry
On my machine, this runs fine, but when I try to run it on someone
elses machine it blows up with an attribute error:


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()


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?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: win32com.client.constants - AttributeError

2006-04-20 Thread Roger Upole
The constants are only available if you've run makepy on the
Word object library.

   Roger

"kbperry" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> On my machine, this runs fine, but when I try to run it on someone
> elses machine it blows up with an attribute error:
>
> 
> 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()
> 
>
> 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 =---
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: win32com.client.constants - AttributeError

2006-04-21 Thread kbperry
how do I do this?  Where is the Word object library?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: win32com.client.constants - AttributeError

2006-04-21 Thread kbperry
Please help!  Anyone else know?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: win32com.client.constants - AttributeError

2006-04-21 Thread Roger Upole
There are a couple of different ways to run makepy.
Start Pythonwin, and from the menu select
Tools->Com Makepy Utility.  You should see a list
of registered typelibs.  Select "Microsoft Word x.y
Object Library" and hit Ok.
This can also be done programatically by initiating
Word with
win32com.client.gencache.EnsureDispatch('Word.Application')

  Roger

"kbperry" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> how do I do this?  Where is the Word object library?
> 



== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet 
News==
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ 
Newsgroups
= East and West-Coast Server Farms - Total Privacy via Encryption =
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: win32com.client.constants - AttributeError

2006-04-21 Thread kbperry
Wow..I didn't even realize that this existed.  Thanks for your help!

-- 
http://mail.python.org/mailman/listinfo/python-list