Follow the short example below that illustrates some of the possibilities for using VBA when working with a COMSOL model. Running the code in the example requires that LiveLink™ for Excel® is installed, and that a reference to the COMSOL API component has been added to the VBA project in the workbook. For information on how to do this see
Before You Start in the LiveLink™
for Excel® User’s Guide.
For more information about the COMSOL API for VBA refer to the LiveLink for Excel User’s Guide Manual. More examples are included in the file busbar_llexcel.xlsm that you can find in your COMSOL Multiphysics installation directory and in the folder
applications/LiveLink_for_Excel/Tutorials