Run Excel vba macro from Dynamo

Hello,

I developped a Dynamo algorithm to write into Excel some revit informations. I wrote a vba macro in excel to sort and get in shape these informations. And now I try to run my vba macro from Dynamo using Python but it’s not working. I also looked for to convert my vba macro into Python but I couldn’t find a good way to convert into Ironpython (Python used in Dynamo, I think ?)

Capture

Hi Antoine

Since you assigned the application to the name ‘excel’ in line 6, it should work, if you change the line where you run the macro to:
excel.Run(dirmacro)

Thank you for the reply.

I had problems with the import line and I don’t think I was coding in IronPython so I changed everything :

Now the problem is :

It says that Revit can’t find the file in “C:\Users.goudinoux\Desktop\Métrés GO REVIT\MAJ Métrés GO simplifiés.xlsm” but in my code the file is in “C:\Users\a.goudinoux\Desktop\Métrés GO REVIT\MAJ Métrés GO simplifiés.xlsm”. Revit just deleted “\a” so it is normal that he can’t find the file. Do you have any idea of what is the problem ?

Thank you

The right code was :
image

Thank you