Sub Get_Vensim_Info()
Dim buf As String * 512
result = vensim_command(
"SPECIAL>LOADMODEL|c:\Users\Public\dll\worldapp.vmf")
vensim_command ("SIMULATE>CHGFILE|changes.cin")
vensim_command ("SIMULATE>DATA|data")
The first three vensim_command calls load a model and make some changes to the way the model will simulate - mostly to check to see that the changes stick.
For i = 1 To 21
length = vensim_get_info(i, buf, 500)
Worksheets("Sheet1").Cells(21, 5 + i).Value = buf
Next i
We then loop through the different types of information and put the results into successive columns. Note that a couple of these info calls actually return more than one string, but we do not check this. Only the first string will be displayed. We can do this because the Null terminator is the standard string terminator so the contents of buf will be treated as just the first string.
End Sub
Other Info
This example also contains functions to get information about variables and to get results from sensitivity runs. The format of these function calls is very similar to what we have already shown.