We have been shortlisted! We are delighted to be nominated for 5 Tech for Good awards for our work with South African charity Shout It Now. Read more here.
VBA Extension has been superseded by Simul8 COM. The VBA Extension is not actively supported.
How to get started with Visual Basic
A number of example simulations are provided, but the easiest way to understand the Visual Basic extension is to build a small extension to one of your simulations.
To use the Visual Basic extension you need to have Visual Basic Standard (or Professional) edition (version 3 upwards) on your computer.
From the Developer tab click the Extensions button and VISUAL BASIC. Type, for example, TESTVB into the VB PROJECT NAME box and click CREATE.
This will load Visual Basic and create a shell program (called TESTVB) ready to run with Simul8. It contains sample code so you can see how it works.
If you are not familiar with Visual Basic its, windows and commands will take some getting used to. In the window on the right hand side press the “View Code” button.
A blank window will appear with the heading “Object” and the selection “(general)”.
Click the drop down arrow and select “Form”.
You will now see some code.
Basically, the code says “if you are sampling the distribution called Distrib1 then change its mean value to the value that appears in text box 1 on the screen”.
To use this piece of code change one of the Work Centers in your simulation to use a new distribution called Distrib1 and check the “ASK VISUAL BASIC” box in that distribution's dialog box.
Now run the Visual Basic program (click 'play' in Visual Basic) and go back to Simul8, restart the clock and set the simulation running.
The Work Center will take (on average) the amount of time in the box on the screen to process each Work Item.