WITHIN POWERPOINT:
Here are 5 simple steps that will have you executing your MATLAB code from
PowerPoint in no time!
enableservice('automationserver',true);
2) Within PowerPoint, launch the Visual Basic editor, create a module, and paste this
function in it:
%%%
%%%
3) To call a file in MATLAB, paste a custom subroutine underneath the Sub RunFile
code, of the following format:
Sub FILENAME()
Call RunFile("COMMANDS TO RUN", "DIRECTORY TO SWITCH TO")
End Sub
For instance, let’s assume that we want to run a file entitled assayTool that resides in
"C:\MFILES\Assay Tool". Moreover, we want to issue a clear all;close
all;clc; before we run it, and we want to change directories to that containing
AssayTool.
Sub RunAssayTool()
Call RunFile("clear all;close all;clc;assayTool", "C:\MFILES\Assay
Tool")
End Sub
4) Link the subroutine to some object, picture, text, etc. that you want to use to trigger the
behavior in PowerPoint. (Right-click on the object, select Action Settings, and from the
“Mouse Click” tab, select “Run Macro.” Browse to select from the module the subroutine
RunAssayTool.
I ALWAYS only edit that single .BAS file. If I want to update the macros in a given
PowerPoint, I delete the current module, modify RunFilesMain.bas, and reimport it. All
existing links to subroutines will be automatically re-established (unless you’ve changed
the name of the subroutine.) This greatly simplifies management of the VB routines.