[python-win32] Error in word with AddTextbox

Tim Roberts timr at probo.com
Tue Feb 23 12:43:58 EST 2016


Sylvain Fauveau wrote:
> 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)

The documentation for AddTextBox would have explained this.  You need to
use msoTextOrientationHorizontal, not wdTextOrientationHorizontal.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list