File Exchange

image thumbnail

Run MS Excel macro

version 1.0 (3.5 KB) by

Run MS Excel macro with or without parameters

4 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 (4)

Manoj Negi

Just need one help. I have one excel file Trailing.xlsm where liveprice is the name of macro. But this excel file runs with administrator rights only. If I won't open file with administrator rights then macro is showing #NA. How should I open it without showing #NA? Any help regarding this will be great!!!

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

Win prizes and improve your MATLAB skills

Play today