| View previous topic :: View next topic |
| Author |
Message |
starlight
Joined: 22 Apr 2009 Posts: 6
|
Posted: Fri Jun 26, 2009 11:22 am Post subject: Interface |
|
|
I want to create an interface for my Automod simulation model by using Excel. In the AutoMod help I saw an example to change some variables of the model from excel file before or during simulation. But I could not find the code for this function.
Can anyone give example for this? How can I call a variable value from Excel to Automod Runtime and also from Automod Runtime to Excel?
Thank you,
Nihal |
|
| Back to top |
|
 |
johngibbons
Joined: 14 Mar 2008 Posts: 69 Location: Holland, MI
|
Posted: Sat Jun 27, 2009 9:55 am Post subject: |
|
|
In latest version there are 6 new excel file functions
XLGet XLSet single cell read and write
XLGetA1 XLSetA1 column of data
XLGetR1C1 XLSetR1C1 two dim area of data
check help for syntax of each one
XLGet(<worksheet>, <cell>)
XLGetA1(<worksheet>, <column letter>, <row number>)
XLGetR1C1(<worksheet>, <row number>, <column number>)
XLSet(<worksheet>, <cell>, <data>)
XLSetA1(<worksheet>, <column letter>, <row number>, <data>)
XLSetR1C1(<worksheet>, <row number>,<column number>, <data>)
value is an empty string (“”).
Data written with the XLSet functions must be string data—AutoMod string variables or attributes,
or string constants (strings of characters between double quotes). The XLSet functions return true
(1) if successful and false (0) if unsuccessful
There is an example in Jan 2007 Autoflash - this also has code in a zip file. Are you current with maintenance contract? If so go to site and download both files. _________________ John Gibbons
LinkedIn Profile http://www.linkedin.com/in/johngibbons1 |
|
| Back to top |
|
 |
starlight
Joined: 22 Apr 2009 Posts: 6
|
Posted: Wed Jul 01, 2009 2:37 pm Post subject: |
|
|
Thank you for your help, but unfortunately I don't have the latest version of Automod. Do GetVariable, SetVariable functions work in the same way?
More specifically, when I write the following code to Excel interface as explained in help:
" Public amx As AMRunX
Private Sub TextBox1_Change()
Call amx.SetVariable("V_speed", Sheet2.TextBox1.Value)
End Sub "
I receive this error: Object variable or with block variable not set, even though I set the object variables and the model is communicating with the interface which I control with ActiveX.
Should I also modify something in Automod syntax?
Thank you.. |
|
| Back to top |
|
 |
johngibbons
Joined: 14 Mar 2008 Posts: 69 Location: Holland, MI
|
|
| Back to top |
|
 |
starlight
Joined: 22 Apr 2009 Posts: 6
|
Posted: Fri Jul 03, 2009 12:03 pm Post subject: |
|
|
| I use version 11.2. |
|
| Back to top |
|
 |
johngibbons
Joined: 14 Mar 2008 Posts: 69 Location: Holland, MI
|
Posted: Sun Jul 05, 2009 12:21 pm Post subject: |
|
|
reading back in very old documentation for this...
do you have:
You must also
include the following add-ins in Excel:
• Analysis Toolpak
• Analysis Toolpak - VBA
• Solver Add-in
To include the add-ins in Excel, click Tools > Add-Ins.
Also might have issue running 11.2 code with new flavor of excel. By this I mean if you are running with a version of excel that was never supported by automod at the time then you are on your own.
also your machine might be missing a needed library or the file is in a different place:
The Visual Basic code that allows communication
between the model and the excel was developed
in relies on Microsoft object libraries for
necessary subroutines. Often the configuration of these
libraries can vary from one machine to another, depending
on which Microsoft products have been installed on a particular
machine. If a referenced library is missing, or is
stored in a different directory, the database may open
directly into the Visual Basic debugger.
hope this helps... _________________ John Gibbons
LinkedIn Profile http://www.linkedin.com/in/johngibbons1 |
|
| Back to top |
|
 |
|