Hello,
I am trying to use Vensim Full Dll to integrate vensim models with our Visual Basic 6 modeling application.
Within our vb6 application, I can open, add data (from our model to vensim), run and show results from models developed with Vensim. However, when I unload the vb6 form used for this purpose, I am not sure what's happening to the files and variables used by the vensim dll. I am asking this because, as the vb6 form is being reloaded, I am not able to delete the .vdf files I used before. I get a "permission denied" from vb. I cannot delete the files (at this stage) even in windows explorer. It says files are being used by some other application. If I skip the deletion of file deletion code, I get an error message further down where I am trying to load the (same) model again.
I tried Special>Clearruns, Menu>Exit etc., but they did not work.
Could you please help?
Thank you.
-Mohammod
vensim and vb6
Welcome to the forum!
I don't currently have time to test this but from what I understand of your problem, I would suggest trying the following Venapp command:
SPECIAL>STOPSIM|option
Stops a simulation. Use option of SAVE to save the results so far, NOSAVE to discard results and QUERY to ask the user. The options have no effect in gaming mode — the output is always saved. This command must appear first in the list of commands, and will be the only command executed during simulation. If this command is invoked and there is no simulation in progress, it has no effect, and the commands that follow it are executed.
Hope this helps.
Lee
I don't currently have time to test this but from what I understand of your problem, I would suggest trying the following Venapp command:
SPECIAL>STOPSIM|option
Stops a simulation. Use option of SAVE to save the results so far, NOSAVE to discard results and QUERY to ask the user. The options have no effect in gaming mode — the output is always saved. This command must appear first in the list of commands, and will be the only command executed during simulation. If this command is invoked and there is no simulation in progress, it has no effect, and the commands that follow it are executed.
Hope this helps.
Lee
I've never used the Vensim DLL thru' VB6, but have you tried using the "vensim_get_info" command to find out the exact status of what is going on at different steps during you VB application. You can use this to tell you what model & vdf's are still loaded if any, amongst many other things.
Have a look in the Vensim help file for the exact syntax of the command required.
Does seem strange, if you have cleared all runs but they still appeared locked into the application.
Sorry I can't be of more help.
Have a look in the Vensim help file for the exact syntax of the command required.
Does seem strange, if you have cleared all runs but they still appeared locked into the application.
Sorry I can't be of more help.
I think, I discovered one part of the problem.
The function vensim_get_data does not close the .vdf it opens for reading the data.
However, I still have one problem. As soon as I try Special>LoadModel upon reentering the vb6 form used for integration, I am thrown out of VB (IDE closes right away). I tried loading models from different folder (as suggested by vensim support) with different name. But same thing happens.
However, this does not happen with the example provided by vensim (it can be easily tested by adding a form to the example project) !
-Mohammod
The function vensim_get_data does not close the .vdf it opens for reading the data.
However, I still have one problem. As soon as I try Special>LoadModel upon reentering the vb6 form used for integration, I am thrown out of VB (IDE closes right away). I tried loading models from different folder (as suggested by vensim support) with different name. But same thing happens.
However, this does not happen with the example provided by vensim (it can be easily tested by adding a form to the example project) !
-Mohammod
Hi everybody !
I think I am encountering the same problem as in the previous message. I am using the function vensim_get_data() to read the .vdf file in an Excel/VBA workbook and according to the result, I may need to run my model with the same vdf name. However, this is impossible as the file .vdf seems to be still opened by the vensim-get_data().
Does anyone knows a trick to release the file in my VBA code?
Thanks.
Pierre
I think I am encountering the same problem as in the previous message. I am using the function vensim_get_data() to read the .vdf file in an Excel/VBA workbook and according to the result, I may need to run my model with the same vdf name. However, this is impossible as the file .vdf seems to be still opened by the vensim-get_data().
Does anyone knows a trick to release the file in my VBA code?
Thanks.
Pierre
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
Clearruns on the VBA side might help, but there may have been bugs in 5.7 on this (I kind of remember that, though it was a long time ago). If you execute the run from within VBA (Rather than opening Vensim DSS with a command script) you might get better results. Alternatively use the command script for everything and export the data for use in Excel.