Author Topic: can we call VBA user-defined function in Python using pyxll?  (Read 585 times)

utrbc

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
can we call VBA user-defined function in Python using pyxll?
« on: January 29, 2014, 05:43:09 PM »
Another question: can we call VBA user-defined function in Python using pyxll? Say, I have a user-defined function func() in a vba module, during the runtime, I want to call it in Python and do more computation with the its return value.

Thanks in advance.

Tony

  • Administrator
  • Hero Member
  • *****
  • Posts: 568
  • Karma: +13/-1
    • View Profile
Re: can we call VBA user-defined function in Python using pyxll?
« Reply #1 on: January 29, 2014, 05:53:52 PM »
Hi,

yes, you want the 'Run' method from the Excel application object. The automation example shows how to get the application object (see the function 'xl_app').

Details of the Run method are on msdn here:
http://msdn.microsoft.com/en-us/library/office/ff197132.aspx

cheers,
Tony