Run Octave from Excel via VBA

We wanted to run Octave from Excel via VBA using the VBA Shell function. Here is our VBA code:

Shell (“C:\Program Files\GNU Octave\Octave-7.1.0\mingw64\bin\octave.exe runModel.m”)

The VBA would skip this line and do nothing. It does not seem to execute Octave or run the octave program.

Any idea? Thanks!

My system

  • OS: Windows 10
  • Octave version: Version 7.1.0**
  • Installation method: e.g. Downloaded and installed “octave-7.1.0-w64-installer.exe” from Download

Try installing Octave in a place without spaces, like “C:\Octave”. Also check to see if you need to escape the backslashes with "\\".

The way your command is currently written, the shell is trying to execute a program named “C:\Program” with the arguments “Files\GNU”, “Octave\Octave-7.1.0\mingw64\bin\octave.exe” and “runModel.m” and the backslash symbols are causing more confusion to the shell.

1 Like

Try running the launcher rather or the .vbs script from the installation rather than the octave executable directly.

1 Like