The BuiltInDocumentProperties collection cannot be accessed nor with call nor with getitem.
Converting to list does not work neither. Only iteration works.
With doc being a Word Document:
print doc.BuiltInDocumentProperties
print [d for d in doc.BuiltInDocumentProperties]
print doc.BuiltInDocumentProperties(1)
gives
<win32com.gen_py.Microsoft Office="" 9.0="" Object="" Library.DocumentProperties="" instance="" at="" 0x72132648="">
[<win32com.gen_py.Microsoft Office="" 9.0="" Object="" Library.DocumentProperty="" instance="" at="" 0x72132768="">,
...,
<win32com.gen_py.Microsoft Office="" 9.0="" Object="" Library.DocumentProperty="" instance="" at="" 0x72134048="">, <win32com.gen_py.Microsoft Office="" 9.0="" Object="" Library.DocumentProperty="" instance="" at="" 0x72134088="">]
Traceback (most recent call last):
File "C:/Documents and Settings/gfj138/My Documents/PycharmProjects/GOOD_repo/good/yap/offer_generator.py", line 266, in <module>
generate_all_texts()
File "C:/Documents and Settings/gfj138/My Documents/PycharmProjects/GOOD_repo/good/yap/offer_generator.py", line 240, in generate_all_texts
doc = generate_offer(wb)
File "C:/Documents and Settings/gfj138/My Documents/PycharmProjects/GOOD_repo/good/yap/offer_generator.py", line 47, in generate_offer
print doc.BuiltInDocumentProperties(1)
AttributeError: DocumentProperties instance has no call method
On a DocumentProperty, nor the Name nor the Value attribute works
print [d.Name for d in doc.BuiltInDocumentProperties]
gives
Traceback (most recent call last):
File "C:/Documents and Settings/gfj138/My Documents/PycharmProjects/GOOD_repo/good/yap/offer_generator.py", line 266, in <module>
generate_all_texts()
File "C:/Documents and Settings/gfj138/My Documents/PycharmProjects/GOOD_repo/good/yap/offer_generator.py", line 240, in generate_all_texts
doc = generate_offer(wb)
File "C:/Documents and Settings/gfj138/My Documents/PycharmProjects/GOOD_repo/good/yap/offer_generator.py", line 46, in generate_offer
print [d.Name for d in doc.BuiltInDocumentProperties]
File "C:\Program Files\Anaconda\envs\good\lib\site-packages\win32com\client__init.py", line 465, in getattr__
raise AttributeError("'%s' object has no attribute '%s'" % (repr(self), attr))
AttributeError: '<win32com.gen_py.Microsoft Office="" 9.0="" Object="" Library.DocumentProperty="" instance="" at="" 0x72087712="">' object has no attribute 'Name'