Home > Archive > Tcl > February 2007 > Excel solver from tcom?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Excel solver from tcom?
|
|
| Georgios Petasis 2007-02-25, 7:09 pm |
| Hi all,
Does anyone knows how to control the excel solver addin from tcom?
I have found how to load the plugin, but I don't know how to interact
with the loadded plugin:
set excel [::tcom::ref createobj Excel.Application]
set addins [$excel AddIns]
set count [$addins Count]
set pattern solver.*
for {set i [expr {1}]} {$i <= $count} {incr i} {
set addin [$addins Item $i]
set name [$addin Name]
if {[string match -nocase $pattern $name]} {
$addin Installed 1
break
}
}
Recording the relevant macros from excel, it ends up using functions
like SolverOk & SolverAdd. These are available in VBA, but I am not sure
I can use them through tcom. Any ideas?
George
| |
| palmtcl@yahoo.com 2007-02-25, 7:09 pm |
| Could you post the VBA samples?
On Feb 25, 8:29 pm, Georgios Petasis <peta...@iit.demokritos.gr>
wrote:
> Hi all,
>
> Does anyone knows how to control the excel solver addin from tcom?
> I have found how to load the plugin, but I don't know how to interact
> with the loadded plugin:
>
> set excel [::tcom::ref createobj Excel.Application]
> set addins [$excel AddIns]
> set count [$addins Count]
> set pattern solver.*
> for {set i [expr {1}]} {$i <= $count} {incr i} {
> set addin [$addins Item $i]
> set name [$addin Name]
> if {[string match -nocase $pattern $name]} {
> $addin Installed 1
> break
> }
>
> }
>
> Recording the relevant macros from excel, it ends up using functions
> like SolverOk & SolverAdd. These are available in VBA, but I am not sure
> I can use them through tcom. Any ideas?
>
> George
| |
| Georgios Petasis 2007-02-25, 7:09 pm |
| The recorded VBA looks like this:
SolverOk SetCell:="$A$3", MaxMinVal:=1, ValueOf:="0", ByChange:="$B$1:$B$3"
SolverAdd CellRef:="$A$3", Relation:=1, FormulaText:="3"
SolverSolve
It has these Solver* functions, which are not visible in the objects
browser in the VBA editor...
George
O/H palmtcl@yahoo.com _γραψε:
> Could you post the VBA samples?
>
> On Feb 25, 8:29 pm, Georgios Petasis <peta...@iit.demokritos.gr>
> wrote:
>
>
|
|
|
|
|