Recently I get Tcl Windows API extension 2.0.12 and try some example
to MS EXCEL ( from http://twapi.magicsplat.com/). It didn't work --->
why ???
code:
package require twapi
set xl [twapi::comobj Excel.Application]
$xl Visible true
set workbooks [$xl Workbooks]
set workbook [$workbooks Add]
set sheets [$workbook Sheets]
set sheet [$sheets Item 1]
set cells [$sheet range a1 c3]
$cells Value 12345
$cells -destroy
$sheet -destroy
$sheets -destroy
$workbook -destroy
$workbooks -destroy
$xl Quit
$xl -destroy
error message:
occur exception condition。
while executing
"twapi::IDispatch_Invoke _5cb81700_p_IDispatch {6 {} 0 2 12 {{12 17}}}
12345"
("uplevel" body line 1)
invoked from within
"DbgNub_uplevelCmd DbgNub_uplevelCmd $args"
invoked from within
"uplevel 1 [list twapi::IDispatch_Invoke $ifc $prototype] $args"
(procedure "twapi::idispatch_invoke" line 7)
invoked from within
"twapi::idispatch_invoke _5cb81700_p_IDispatch {6 {} 0 2 12 {{12 17}}}
12345"
("eval" body line 1)
invoked from within
"eval [list twapi::idispatch_invoke $ifc
$::twapi::idispatch_prototypes($ifc,$name,0,$flags)] $params"
(procedure "::twapi::_comobj_wrapper" line 342)
invoked from within
"$cells Value 12345"
Could some one give me some direction to solve this error?
My platform: windows XP3
Tcl rev. 8.4.18.0
BR
Rolance
Alternately, you could try using the Tcom extension instead of twapi
to see if that works better for the Value method.
Also, please do not post in multiple threads.
/Ashok
rolance wrote:
> Dear All
>
> Recently I get Tcl Windows API extension 2.0.12 and try some example
> to MS EXCEL ( from http://twapi.magicsplat.com/). It didn't work --->
> why ???
>
> code:
>
> package require twapi
>
> set xl [twapi::comobj Excel.Application]
> $xl Visible true
> set workbooks [$xl Workbooks]
> set workbook [$workbooks Add]
> set sheets [$workbook Sheets]
> set sheet [$sheets Item 1]
> set cells [$sheet range a1 c3]
> $cells Value 12345
> $cells -destroy
> $sheet -destroy
> $sheets -destroy
> $workbook -destroy
> $workbooks -destroy
> $xl Quit
> $xl -destroy
>
> error message:
>
> occur exception condition $B!# (B
Hi Ashok
Thank for your advice! value2 ---> worked
Could you give me some link to get the newest MS EXCLE or MS WORD
function parameter list (syntax)?
thank
BR
Rolance
Sorry, I don't have a reference. Google is your friend. Or you go to
the Microsoft msdn site.
/Ashok