Excel Connection Example
Module1.bas is a very simple example of how one might go about connecting an Excel spreadsheet to FEMM using ActiveX. The example script opens up an instance of femm and asks for the value of μo, the magnetic permeability of free space. The resulting value is pasted into a particular element of the spreadsheet.
To load and run the example script, do the following:
- Select Tools|Macros|Visual Basic Editor off of the main menu of Excel.
- The VB IDE will pop up. Select File|Import File off of the VB IDE main menu. Import "module1.bas" using the file selection dialog that pops up.
- In the "VBA Project" window on the left-hand side of the screen, select Module 1.
- Push the "Play" button on the toolbar to run the script.
When the script is run, the FEMM window pops up very briefly. The resulting value is displayed on the mail Excel window in column B, row 10.