User`s guide

2 Programming with MATLAB Builder for Excel
Over view of the Integration Process
Each MATLAB Builder for Ex cel component is built as a CO M object that you
can a ccess from Microsoft Excel through Visual Basic for Applications (VBA).
This topic provides general informationonhowtointegrateExcelBuilder
components into Excel using the VBA programming environment. It assumes
that you have a w orking knowledge of VBA and is not intended to discuss how
to program in Visual Basic. Refer to the VBA documentation provide d w ith
Excel for general programming information.
You can integrate Excel Builder components into a VBA project by creating a
simple code module with functions and/or subroutines that load the necessary
components, call methods as needed, and process any erro rs. In g eneral, you
need to address the following items in anycodewrittentouseExcelBuilder
components:
“When to Use a Formula Function or a Subroutine” on page 2-3
“Initial izing MATLAB Bu ilder for Excel Libraries with Ex c el” on page 2-4
“Creating an Instance of a Class” on page 2-6
“Calling the Methods of a Class Instance” on page 2-9
“Processing varargin and varargout Arguments” on page 2-11
“Handling Errors D uring a M ethod Call” on page 2-13
“Modifying Flags” on page 2-14
Note All code samples in these topics are for illustration purposes and
reference a hypothetical class named
myclass contained in a component
named
mycomponent w i th a version number of 1.0.
For a list of working code examples, go to the Examples index.
2-2