The COMSOL API
COMSOL provides an API based on Java® that makes it possible to access COMSOL models settings and results. The COMSOL API consists on approximately 200 classes. These classes contain many methods each. All these methods are covered in the COMSOL Programming Reference Manual.
Adapting COMSOL API Code in VBA
The COMSOL Desktop supports saving model as JAVA-file, which is very convenient to learn the COMSOL API syntax. However, the code generated in the JAVA-file requires some adaption to be run in VBA. The difference between the code to be used with JAVA and with VBA consist in:
The keyword Call has to be used on every line calling a method in the COMSOL API when the method does not return anything.
The set method in the COMSOL API does not return anything in VBA, while it returns a reference to the object being changed in Java.