Using Octave to run Excel macro (from personal workbook)

0

I'm following the methods of this Mathworks post (but using Octave 6.2.0 instead of Matlab)

https://www.mathworks.com/matlabcentral/answers/100938-how-can-i-run-an-excel-macro-from-matlab

to open an Excel file (Office 365 version) and execute a macro. It works very well to a point (i.e. on a test Excel file containing a test macro). However, in practice I'm using the xlsopen(...) , oct2xls(...), and xlsclose(...) functions in Octave to create the Excel file I ultimately want to use, so I think I either have to...

(a) use Octave to create an Excel file containing a VBA macro, or

(b) adapt one of the options in the Mathworks post to be able to run a macro from the 'PERSONAL.xlsb' workbook instead. I've tried changing the 'Macro1' name to PERSONAL.xlsb!Macro1 (with 'Macro1' coded into a module within the personal workbook) but this does not execute the macro and gives the following error in Octave:

error: com_invoke: property/method invocation on the COM object failed with error `0x80020009' - Exception occurred.

Invoking the macro coded into the personal workbook directly from the active workbook is successful (even if it's a different workbook), I just need Octave to do this step.

Are either of these possible to do, or is there another alternative? Thanks in advance.

excel
vba
octave
export-to-excel
asked on Stack Overflow Apr 29, 2021 by smcmi

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0