File Exchange

image thumbnail

Run MS Excel macro

version 1.0 (3.5 KB) by

Run MS Excel macro with or without parameters

10 Downloads

Updated

View License

Run MS Excel macro

USAGE
xls_run_macro(xlsfile,macro)
xls_run_macro(xlsfile,macro,params)

INPUT
- XLSFILE: name of the XLS-file
- MACRO: macro name
- PARAMS: parameters for the MACRO

OUTPUT
- XLSFILE will be edited

N.B.
- In some cases when an error occurs, MS Excel must be manually closed (in Task Manager for Windows systems)
- Some macros do not run if the visibility of MS Excel is off. So it is on by default.

Comments and Ratings (3)

Eddy Barratt

Very helpful, and it works well. I made a slight edit to make the set(Excel, 'Visible',1) line optional, as the macro seemed to work fine without it for me. I then run it in a try-catch loop and turn visible on if I have an error.

Eddy Barratt

Santiago

Thanks! Found it very useful!

MATLAB Release
MATLAB 7.10 (R2010a)
Tags Add Tags
Acknowledgements

Inspired by: Check if XLS file is open and close it

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video