How to Generate Python Modules of MS Office Constants

I spent ages trying to work out how to create a .py module that contained the MS Office enumeration constants as referenced in this article s-anands-anand-1

I solved it with reference to this entry in stackoverflow

The snippet below creates four python module for each of Microsoft Office, Excel, Word and Powerpoint in the “MSOconstants” directory of my Jupyter Lab notebook location (I’m using Jupyter Lab notebooks.  You can reference any folder location of your choice).


Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

I hope this save you some time and frustration.

Note:  if you have Microsoft Project then you can create the equivalent by referencing “Microsoft Office 14.0 Object Library” (14.0 is the version I happen to have, you may have a different version).  This is important as in a later blog I will outlining how to use win32com with MS Project.

3 thoughts on “How to Generate Python Modules of MS Office Constants

  1. Pingback: Using win32com To Work with Microsoft Office Applications | Eric Garlic Project Managers Toolkit

  2. Pingback: Reading and Interpreting MSDN Object Model Reference | Project Managers Toolkit

  3. Pingback: Flatten Microsoft Project to Pandas DataFrame | Project Managers Toolkit

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s