[python-win32] Open MS Word, execute specific Ribbon command

Nicolas Göddel n.goeddel at satzweiss.com
Tue Dec 6 09:44:39 EST 2016


Hi there,

I am able to start Word, open a file, find its window handle and the handle of
the Ribbon. Now I want to switch to an other tab within the Ribbon and execute a
specific command.

It seems now that I need these API calls to do this directly without simulating
key presses:
- GetAccessibleObject
- GetObjectByName

Unfortunality I can not find them inside the pywin32 library. The code I am
trying to convert to Python is this one: 

https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/07/18/15/86/AccessRibbonTab.zip

The main problem is that I want to execute a Ribbon command which is provided by
a third party Word plugin, namely axesPDF. This plugin does not provide an APIs
to use it in a Word Macro or from external via command line. So all I can do is
opening the file in Word, press that specific Ribbon button, save the file an
quit Word.

At the moment I am trying to use AccessibleObjectFromWindow from oleacc.dll but
I neither don't know if that is the right direction nor how to access this API
correctly with ctypes. I am still trying... ;-)

-- 
Mit freundlichen Grüßen
Nicolas Göddel

----------------------------------------------------------------
Satzweiss.com Print, Web, Software GmbH
Mainzer Straße 116
66121 Saarbruecken
Tel. 06 81 / 6 55 60
Fax 06 81 / 6 55 70
ajw at satzweiss.com | www.satzweiss.com
Sitz der Gesellschaft:
Saarbrücken | HRB 9126
USt.Id.Nr. DE138115193
Geschäftsführer: Anja Jansen-Winkeln, Roman Jansen-Winkeln



More information about the python-win32 mailing list