Dear TRon, rvk and Thaddy,
thank you for your suggestions. I made my demo program and compiled it with laz 1.8.4. and 2.2.4. In the program I create a variant array of 2*2 and fill it with "1" numbers. After that I (would like to) add this variant array to an excel range.
The program compiled with 1.8.4. works as it should, but the one compiled with 2.2.4. gives an error message.
You can download the exe-s from here:
https://drive.google.com/file/d/1ypN8w70jXuLaPPbu15kZ_iKgWeFj2baj/view?usp=share_linkThe code is the following:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComObj,
Variants;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
E,arr: Variant;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
E:=CreateOleObject('Excel.Application');
E.WorkBooks.Add;
E.Visible:=True;
arr:=VarArrayCreate([0,1,0,1], VarVariant);
arr[0,0]:=1;
arr[1,0]:=1;
arr[0,1]:=1;
arr[1,1]:=1;
E.ActiveSheet.Range(E.ActiveSheet.Cells[1,1],E.ActiveSheet.Cells[2,2]):=arr;
E:=Unassigned;
end;
end.