Author Topic: accessing object model properties with arguments  (Read 345 times)

aaron_qzb

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
accessing object model properties with arguments
« on: December 30, 2015, 12:03:31 AM »
Hi, how can I access a property with arguments? For example, in VBA I can do:

Dim R as Range
Set R = Selection
relative_address = R.Address(False, False)

but in Python,
R.Address(False, False) does not work because R.Address is a string, not a callable function.

Any workarounds?

Tony

  • Administrator
  • Hero Member
  • *****
  • Posts: 610
  • Karma: +14/-1
    • View Profile
Re: accessing object model properties with arguments
« Reply #1 on: December 30, 2015, 08:43:27 AM »
Hi Aaron,

try using win32com.client.EnsureDispatch when getting the COM object. That should create the wrappers from the typelib instead of using dynamic bindings, which should allow you to call properties with arguments.

Best regards,
Tony