1

I'm using win32com to access MS Project data from Python. Now I need to access the TimeScaleData of an assignment using code similar to the one shown in the accepted answer of this question.

Tasks_collection = ActiveProject.Tasks
for t in Tasks_collection:
    for r in t.Assignments:
        TSV_collection = r.TimeScaleData('06/01/2019','08/01/2019',\
                                         pjAssignmentTimescaledWork,pjTimescaleDays)
        for tsv in TSV_collection:
            print(tsv.Value)

But I have no idea where or how pjAssignmentTimescaledWork and pjTimescaleDays are defined. I've already checked multiple questions regarding VBA, MS Project, win32com in Python, but none of them explain how to access the enumerations of the project model. I found out what pjAssignmentTimescaledWork actually was when I came across Microsoft's VBA documentation for Enumerations. But I haven't been able to find how to access those variables from Python, using win32com.

I also checked Microsoft Office's constants, generating them myself following the code I found here, but none of those constants are the ones shown in Microsoft's documentation.

Can someone offer me some insight regarding MS Project Enumerations in Python? Or more specifically, how to define pjAssignmentTimescaledWork and pjTimescaleDays, so that I can use the method TimeScaleData with its Type and TimeScaleUnit parameters (documented here)?

Camilo Martinez M.
  • 1,420
  • 1
  • 7
  • 21
  • Take a look at [Accessing enumeration constants in Excel COM using Python and win32com](https://stackoverflow.com/questions/21465810/accessing-enumeration-constants-in-excel-com-using-python-and-win32com) and [How do I import a COM object namespace/enumeration in Python?](https://stackoverflow.com/questions/1646230/how-do-i-import-a-com-object-namespace-enumeration-in-python). – Rachel Hettinger Nov 03 '22 at 18:22
  • I already ran `makepy` using those steps and generated a file called `MSO.py`, but none of the constants listed there match any variable name in Microsoft's documentation about enumerations. I'm either missing something or Microsoft Office `constants` are not what I'm looking for. – Camilo Martinez M. Nov 03 '22 at 18:26
  • You can always declare just the specific constants you need... – Tim Williams Nov 03 '22 at 20:09

0 Answers0