xsharp.eu • OLEAutoObject
Page 1 of 1

OLEAutoObject

Posted: Fri Jul 21, 2023 3:15 pm
by AlessandroV
Hi to all, i have ported from VO:
oExcel := OLEAutoObject{"Excel.Application"}

it work until <<== ERROR

        oExcel:Caption := cFileName
        oExcel:visible := FALSE
        oWorkbooks := oExcel:Workbooks
        oWorkbook := oWorkbooks:Add() 
        
        oWorksheet := oWorkbook:Worksheets[1]    <<== ERROR
        oWorksheet:Name := "Tabella"

I got this error:
value in USUAL does not support indexed operations. The value needs to be an X# Array or implement the interface 'XSharp.IIndexedProperties'.

How is it possible to fix up and recover this code (i hope so) ? Or i have to rewrite all as C# interop ?

Thanks a lot Alessandro

OLEAutoObject

Posted: Fri Jul 21, 2023 6:30 pm
by robert
Alessandro,
There is an Excel example in the Helpfile.

Robert

OLEAutoObject

Posted: Mon Jul 24, 2023 9:25 am
by AlessandroV
ok thanks Robert, i have to use interop ....

Alessandro

OLEAutoObject

Posted: Mon Jul 24, 2023 6:41 pm
by robert
Alessandro,
Yes, the interop DLLs are the way to go.
That will also provide you with code completion in the editor, compiler warnings for incorrect code and faster execution.
Robert