py2exe and COM problem

N

Naytie

I seem to have a problem with a generated .exe file made with py2exe. I
wrote a python program that creates tables in a Word document and
adjusts the size of the tables and then inputs text into each cell
using COM. Everything works well and I do not get errors using Boa
constructor. However when I run the .exe file I get an error:

File "<COMObject <unknown>>", line 3, in SetWidth
pywintypes.com_error: (-2147352561, 'Parameter not optional.', None,
None)

which is a reference to

w.Selection.Tables(1).Columns(1).SetWidth(ColumnWidth=35)

w is an object created with win32 com

w = win32com.client.Dispatch('Word.Application')

I am assuming the 'Parameter not optional' may be saying that I cannot
change the width. This is the correct code that I took from VB. Can
anyone help? I am using Python 2.4 and MS Word 2000.
 
N

Naytie

I figured it out. I can change the table column by selecting it through
the table, e.g.

column = table.Columns(1)

column.Width = 150

etc etc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

easyGUI and py2exe 0
Py2exe and Module Error... 4
Problem with smtplib and py2exe 3
Question on Creating exe file with py2exe 5
Py2exe issue 4
py2exe Problem with cairo 2
twisted and py2exe 1
py2exe problem 1

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top