Hi Unifacers,
I would like to understand how to deal with VARIANT datatype in a COM interface with Uniface.
VARIANT datatype as far as I’ve understood from Microsoft documentation is accepting either strings or numeric or any other datatypes and based on the datatype received it is reacting accordingly.
Giving an easy understandable example (but the problem is generic):
an Excel workbook could be composed from one or more worksheet; when more worksheets are available the program should select the one it wants to work into.
After loading the Excel type library in Uniface and opening the workbook the operation to be called to move to a specific worksheet is:
sheets->get_item(handle out, variant in)
- First param is an output parameter and it is the handle/pointer to the requested sheet
- Second param is a VARIANT and it could be either a number or a string; when number it means the ordinal number identifying the requested worksheet or when string it means the name assigned to the worksheet.
Trying to call the operation with second parameter as string it works!
Unfortunately when an Excel file is opened the program does not (yet) know worksheets names, it should discovered them before using them!
Trying to call the operation with second parameter as number give back $status -1 and $procerror -150 !!!
I made various tests and my current gotfeel is that Uniface COM driver is NOT able to deal correctly with VARIANT datatype.
Am I missing anything?
Any suggestion is welcome!
Regards
Gianni



