Category Archives: MS Word

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.