How did communication with Excel work?
Author: tneeskens@itblockz.nl (Theo Neeskens)
Hi all,
I am looking at an old Uniface application that I am modernizing.
It communicates with Excel by statements like:
perform "OACREATEOBJECT"
or
$12 = AITEM"%%CTYPE%%%·;%%CVALU%%%"
$13 = CPROP
$14 = $abc$
perform "OASETPROPERTY"
Can anybody please help me find some documentation on this used to work?
6 Comments
Local Administrator
Hi Theo,
this uses object automation (OA).
see PL1.PDF of 7.2.04.
11 Programming for OLE automation
Success, Uli
Author: ulrich-merkel (ulrichmerkel@web.de)
Local Administrator
Thanks, I looked everywhere except in the most obvious location...
Author: Theo Neeskens (tneeskens@itblockz.nl)
Local Administrator
I would like if more members use this way to ask for "need just a link to the info about ....".
And it would be nice if more members reply to these (mostly trivial) questions fast (< 1hr).
We have to help each other to benefit from "swarm intelligence".
If all are consumers only, no added value will be produced.
Success, Uli
Author: ulrich-merkel (ulrichmerkel@web.de)
Local Administrator
Hi Theo,
Maybe this example might help you:
http://www.tonymarston.net/uniface/tip39.html
Kr.
Erik
Author: ESpaltman (erik@spaltman.nl)
Local Administrator
Hi Erik,
Unfortunately the example is too modern for me.
I am looking for OLE Automation, That came after DDE and before signatures in Uniface.
But slowly I am getting somewhere, in the testprogram below I fail at the third perform. Suggestions anybody?
$13 = "Excel.Application"
Perform "OACREATEOBJECT" ; Create excel object
If ($status != 0)
Askmess/nobeep "Excel server not available", "OK"
Else
$EXCEL_APP$ = $12
Endif
$12 = $EXCEL_APP$
$13 = "Visible"
$14 = "B·;1"
Perform "OASETPROPERTY" ; Make it visible
If ($status != 0)
$ERROR$ = "T"
Else
$RESULT$ = $15
Endif
$12 = $EXCEL_APP$ ; get object from local variable
$13 = "PG;Worksheets;M;Add;0;PS;Name;S;Forecast" ; Create a worksheet and call it Forecast
perform "OAEXECMULTIV" ; invoke
$12 = $EXCEL_APP$
$13 = "Quit"
$14 = ""
Perform "OAINVOKE" ; Quit Excel
If ($status != 0)
$ERROR$ = "T"
Else
$RESULT$ = $15
Endif
$12 = $EXCEL_APP$
Perform "OADESTROYOBJECT" ; Destroy the object
$EXCEL_APP$ = ""
Author: Theo Neeskens (tneeskens@itblockz.nl)
Local Administrator
Hi Theo,
if you say "fail" what is the info you get back from the system?
$13 = "PG;Worksheets;M;Add;0;PS;Name;S;Forecast" ; Create a worksheet and call it Forecast
With the multi-commands you call:
- The Method "Add" to the object Worksheets.
- And set the attribute NAME to the new created worksheet object.
Perhaps the EXCEL you use has different methods
(I had these problems with a german EXCEL).
You can give it a try doing the same manually in excel
while recording your work in a macro.
This macro should +/- have the same instructions as the OLE Automation.
Success, Uli
Author: ulrich-merkel (ulrichmerkel@web.de)