LOADMODEL does not work from Excel
-
- Member
- Posts: 25
- Joined: Tue Sep 16, 2014 2:20 pm
- Vensim version: DSS
LOADMODEL does not work from Excel
Hello, I am trying to run a Vensim model from Excel through the DLL-interface.
To test things I have changed the example code in vendll.xls so that Excel and Vensim work in the directory in which both Excel and Vensim are located.
Sub Get_Vensim_Info()
Dim buf As String * 512
Dim MyPath As String
MyPath = ActiveWorkbook.Path
ChDir MyPath
result = vensim_check_status()
result = vensim_command("SPECIAL>LOADMODEL|worldapp.vpm")
Problem is that the model is not loaded. Result equals '6' after vensim_check_status() - which is confusing as I run this on a freshly booted machine without starting Vensim before testing this - and '0' after loadmodel.
Any ideas?
Win 7 64bit & 6.0b
To test things I have changed the example code in vendll.xls so that Excel and Vensim work in the directory in which both Excel and Vensim are located.
Sub Get_Vensim_Info()
Dim buf As String * 512
Dim MyPath As String
MyPath = ActiveWorkbook.Path
ChDir MyPath
result = vensim_check_status()
result = vensim_command("SPECIAL>LOADMODEL|worldapp.vpm")
Problem is that the model is not loaded. Result equals '6' after vensim_check_status() - which is confusing as I run this on a freshly booted machine without starting Vensim before testing this - and '0' after loadmodel.
Any ideas?
Win 7 64bit & 6.0b
Re: LOADMODEL does not work from Excel
What makes you think it's not loaded? Getting a 0 from check_status after a LOADMODEL could be normal.
What if you call vensim_get_info with 5 for the current model name? Or issue a MENU>RUN|o command?
What if you call vensim_get_info with 5 for the current model name? Or issue a MENU>RUN|o command?
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Member
- Posts: 25
- Joined: Tue Sep 16, 2014 2:20 pm
- Vensim version: DSS
Re: LOADMODEL does not work from Excel
Thank you for the swift reply. Apologies for being to brief in my descropition: If I let the vba-code of the demo continue to run all vensim_get_info is empty which makes me suspect the loadmodel does not work. I have a similar issue with a model I have developed where the Run has no effect. I hope this clarifes my problem.
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: LOADMODEL does not work from Excel
What happens if you put the full path into loadmodel?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Member
- Posts: 25
- Joined: Tue Sep 16, 2014 2:20 pm
- Vensim version: DSS
Re: LOADMODEL does not work from Excel
Putting the full path in the LOADMODEL has the same outcome
Re: LOADMODEL does not work from Excel
Is the result from vensim_command("SPECIAL>LOADMODEL|worldapp.vpm") a 0 or 1?
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Member
- Posts: 25
- Joined: Tue Sep 16, 2014 2:20 pm
- Vensim version: DSS
Re: LOADMODEL does not work from Excel
0 (in all tests)
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: LOADMODEL does not work from Excel
Can you upload your code so we can take a look? Zip the directory you are testing with and then we can try running it on our machines.
Tony.
Tony.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Member
- Posts: 25
- Joined: Tue Sep 16, 2014 2:20 pm
- Vensim version: DSS
Re: LOADMODEL does not work from Excel
See the attached. I took the vendll.xls and included the directory change as indicated in my first post.
- Attachments
-
- Test.zip
- (40.59 KiB) Downloaded 232 times
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: LOADMODEL does not work from Excel
It works fine for me.
Do you have the Vensim model reader installed as well?
Do you have the Vensim model reader installed as well?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Member
- Posts: 25
- Joined: Tue Sep 16, 2014 2:20 pm
- Vensim version: DSS
Re: LOADMODEL does not work from Excel
No - I don't think so. In the Start menu / Vensim there is only a reference to Vensim DSS.
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: LOADMODEL does not work from Excel
What happens if you run Get_Vensim_Info() in the attached? It should fill in the cells F21-Z21 in the spreadsheet.
- Attachments
-
- Test.zip
- (42.62 KiB) Downloaded 236 times
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Member
- Posts: 25
- Joined: Tue Sep 16, 2014 2:20 pm
- Vensim version: DSS
Re: LOADMODEL does not work from Excel
All cells are empty. I single-stepped through the macro and length = '-1' and buf = ''
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: LOADMODEL does not work from Excel
Can you try putting it in a different path (eg, c:\test)?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Member
- Posts: 25
- Joined: Tue Sep 16, 2014 2:20 pm
- Vensim version: DSS
Re: LOADMODEL does not work from Excel
Tried again and no difference. (To mitigate that possible factor I incuded the forced path change in the macros)
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: LOADMODEL does not work from Excel
Do you have a vendll32.dll file in c:\users\public\vensim? Or in c:\users\public\vensim\dll?
If so, delete it and then what happens?
If so, delete it and then what happens?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Member
- Posts: 25
- Joined: Tue Sep 16, 2014 2:20 pm
- Vensim version: DSS
Re: LOADMODEL does not work from Excel
No, I do not have a vendll32.dll in any of those directories. I did a search on C: and I have the dll in
C:\Users\'Username'\Vensim\dll
C:\Users\'Username'\Appdata\local\Vensim
C:\Windows\SysWOW64
and in the directory the Excel file and the model are located.
All dlls have the same length and save date.
C:\Users\'Username'\Vensim\dll
C:\Users\'Username'\Appdata\local\Vensim
C:\Windows\SysWOW64
and in the directory the Excel file and the model are located.
All dlls have the same length and save date.
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Re: LOADMODEL does not work from Excel
I think you will need to reinstall Vensim.
Then make sure you have deleted the DLLs from C:\Users\'Username'\Vensim\dll and C:\Users\'Username'\Appdata\local\Vensim
Do not copy anything into C:\Windows\SysWOW64.
Then make sure you have deleted the DLLs from C:\Users\'Username'\Vensim\dll and C:\Users\'Username'\Appdata\local\Vensim
Do not copy anything into C:\Windows\SysWOW64.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559