Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Are you able to use other languages instead of VB for Excel macros?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

Yes it is possible to write excel macros in Python:

http://www.pyxll.com/docs/macros.html

On a side note, you can even edit the existing macros in Python:

http://stackoverflow.com/questions/9913603/is-it-possible-create-edit-an-excel-macro-from-python

share|improve this answer
    
Very interesting. Do you know, how does the speed of invocation of Excel methods (i.e. round trip Python -> COM -> Excel -> COM -> Python) compares with the of VBA (in %)? I suspect it can be much slower, especially with arrays of Variant types. –  Adam Ryczkowski Oct 7 '12 at 16:41
add comment

Another option is C# using .NET. Check out this link:

http://excel-dna.net/

I've not used it much, but it might be worth a try.

share|improve this answer
add comment

It is important to note, that since exactly all Excel automation capabilities available to VBA are in fact served through the COM interface, you can use any language, which supports Windows COM (ActiveX) objects. It roughly translates to almost every modern programming language on the Planet. I personally successfully used Excel from Wolfram Research Mathematica and pure C++. If you don't have specialized library for handling Excel object hierarchy (like the one that I presume exists for Python), it may not be that nice to use as with native VB.

Visual Basic 6 (and Visual Basic for Applications) were designed with compliance with COM architecture in mind. It means, that most data types defined for COM are native for Excel and they don't need to be transformed upon each call. So I'll suspect, that handling Excel from within VBA is the most efficient.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.