0

I have written a code which opens an excel file via excel wings library and instruct such file to run a macro within the excel file itself. The macro within the file consists of a series of Refreshes which happen on another excel workbook through some excel add ins.

The issue is that when I open the excel file and run the VBA macro from there no issues arise. However, when I use Python to run the process I get a run time error 1004 in the VBA macro, which reads macro not available in the current workbook, despite the macro obviously being there. I believe this is because, for some reason, when Python launches Excel the add ins may not automatically load.

I have long looked for a solution around but nothing satisfactory yet. Any help is massively appreciated!

Cox_Pandas
  • 13
  • 2
  • When launching Excel via automation add-ins are not loaded: if you need them then you will have to load them from your code. – Tim Williams Sep 27 '20 at 22:24
  • Would you know how to do that? I've looked up online but haven't found anything in the right direction, which works in the end. – Cox_Pandas Sep 28 '20 at 05:58
  • https://stackoverflow.com/questions/213375/loading-addins-when-excel-is-instantiated-programmatically – Tim Williams Sep 28 '20 at 06:05
  • I tried that but unfortunately did not work.. – Cox_Pandas Sep 28 '20 at 07:55
  • That doesn't tell us (a) exactly what you tried (b) exactly how it "did not work" You might consider posting your actual code otherwise it's pretty difficult to offer any specific help here. – Tim Williams Sep 28 '20 at 15:38

0 Answers0