[python-win32] Error in word with AddTextbox
Sylvain Fauveau
sfauveau at apli-agipa.com
Tue Feb 23 08:53:34 EST 2016
Hi.
I'm trying to add a textbox in word with python 2.7 / pywin 220 Under Windows Server 2008.
from win32com.client import Dispatch, constants
word = Dispatch('Word.Application')
document = word.Documents.Add()
orientation = constants.wdTextOrientationHorizontal
left = 100
top = 100
width = 200
height=100
document.Shapes.AddTextbox(orientation, left, top, width, height)
This give me this error:
Traceback (most recent call last):
File "add_textbox.py", line 10, in <module>
document.Shapes.AddTextbox(orientation, left, top, width, height)
File "c:\usr\python27\lib\site-packages\win32com\gen_py\00020905-0000-0000-C000-000000000046x0x8x5.py", line 21712, in AddTextbox
, Left, Top, Width, Height, Anchor
pywintypes.com_error: (-2147352567, 'Une exception s'est produite.', (0, None, u'La valeur tapee est en dehors des limites.', None, 0, -2147024809), None)
(A value typed is off limits)
I have absolutely no idea why this example doesn't work.
All the args of the AddTextbox method are not optionnal.
If someone had an idea...
Thanks in advance
More information about the python-win32
mailing list