Smithy888 0 Newbie Poster

I have the following code and am trying to get a range of data in an xl file and put into an array, so I can then analyse it. The array says it is not empty, but how can I see the data as the app fails if I try to show it even if i use vartostr?

[var
arrData : variant;
Range : OLEVariant;
i,j : integer;
SheetName : string;
begin
  SheetName := 'FCastVolcs';
  arrData := VarArrayCreate([1,1,1,1],varvariant);
  Range := WBk.Worksheets[SheetName].Range[WBk.Worksheets[SheetName].cells[1,1],
                                  WBk.Worksheets[SheetName].cells[1,1]];
  arrData := Range.value;
  if varisempty(arrData) then
  showmessage('empty')
  else
  showmessage('not empty');

  showmessage(arrData[1,1]);//FAILS HERE. HOW CAN I SEE DATA]

Many thanks
Paul

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.