LOADMODEL does not work from Excel

Use this forum to post Vensim related questions.
Post Reply
linear feedback
Member
Posts: 25
Joined: Tue Sep 16, 2014 2:20 pm
Vensim version: DSS

LOADMODEL does not work from Excel

Post by linear feedback »

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
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: LOADMODEL does not work from Excel

Post by tomfid »

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?
linear feedback
Member
Posts: 25
Joined: Tue Sep 16, 2014 2:20 pm
Vensim version: DSS

Re: LOADMODEL does not work from Excel

Post by linear feedback »

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.
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: LOADMODEL does not work from Excel

Post by Administrator »

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
linear feedback
Member
Posts: 25
Joined: Tue Sep 16, 2014 2:20 pm
Vensim version: DSS

Re: LOADMODEL does not work from Excel

Post by linear feedback »

Putting the full path in the LOADMODEL has the same outcome
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: LOADMODEL does not work from Excel

Post by tomfid »

Is the result from vensim_command("SPECIAL>LOADMODEL|worldapp.vpm") a 0 or 1?
linear feedback
Member
Posts: 25
Joined: Tue Sep 16, 2014 2:20 pm
Vensim version: DSS

Re: LOADMODEL does not work from Excel

Post by linear feedback »

0 (in all tests)
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: LOADMODEL does not work from Excel

Post by Administrator »

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.
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
linear feedback
Member
Posts: 25
Joined: Tue Sep 16, 2014 2:20 pm
Vensim version: DSS

Re: LOADMODEL does not work from Excel

Post by linear feedback »

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
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: LOADMODEL does not work from Excel

Post by Administrator »

It works fine for me.

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
linear feedback
Member
Posts: 25
Joined: Tue Sep 16, 2014 2:20 pm
Vensim version: DSS

Re: LOADMODEL does not work from Excel

Post by linear feedback »

No - I don't think so. In the Start menu / Vensim there is only a reference to Vensim DSS.
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: LOADMODEL does not work from Excel

Post by Administrator »

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
linear feedback
Member
Posts: 25
Joined: Tue Sep 16, 2014 2:20 pm
Vensim version: DSS

Re: LOADMODEL does not work from Excel

Post by linear feedback »

All cells are empty. I single-stepped through the macro and length = '-1' and buf = ''
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: LOADMODEL does not work from Excel

Post by Administrator »

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
linear feedback
Member
Posts: 25
Joined: Tue Sep 16, 2014 2:20 pm
Vensim version: DSS

Re: LOADMODEL does not work from Excel

Post by linear feedback »

Tried again and no difference. (To mitigate that possible factor I incuded the forced path change in the macros)
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: LOADMODEL does not work from Excel

Post by Administrator »

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?
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
linear feedback
Member
Posts: 25
Joined: Tue Sep 16, 2014 2:20 pm
Vensim version: DSS

Re: LOADMODEL does not work from Excel

Post by linear feedback »

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.
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: LOADMODEL does not work from Excel

Post by Administrator »

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.
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
Post Reply