Board index » delphi » "Undeclared identifier: 'VarArrayCreate'"

"Undeclared identifier: 'VarArrayCreate'"

I am trying to recompile an existing project, but I keep getting the error:
"[Error] ParseCode.pas(112): Undeclared identifier: 'VarArrayCreate'"
Here is the snippet of code:

procedure TDistrictParse.Button1Click(Sender: TObject);
var ExcelApp, ExcelWK, NewExcelWK: variant;
    SheetI, SheetExtent : integer;
    DMList, UserList : variant;
    BufStr, BufStr2 : string;
    Listi : integer;
    ExistID : integer;
    ZipStr : string;
    ZipFile : textfile;
begin
 excelapp:=createoleobject('Excel.Application');
 excelapp.displayalerts:=false;
 excelwk:=excelapp.workbooks.open(dmmap);
 bufstr:=excelwk.sheets['useridmap'].cells[2,1].value;
 sheetextent:=2;
 while bufstr<>'' do
 begin
  bufstr:=excelwk.sheets['useridmap'].cells[sheetextent, 1].value;
  inc(sheetextent);
 end;
  dec(sheetextent, 2);
  DMList := VarArrayCreate([1, sheetextent], varVariant);  <-- error here
  UserList:=vararraycreate([1, sheetextent], varVariant);  <-- error here
 for listi:=1 to sheetextent do

Any ideas?  Thanks in advance!

 

Re:"Undeclared identifier: 'VarArrayCreate'"


Probably the location of VarArrayCreate changed
from one version to the next.

Put the cursor on the word "VarArrayCreate". Hit F1.
Somewhere on the help page (in the upper left corner
in D3) it says what unit the function lives in. Add
that unit to your uses clause.

On 15 Aug 2001 07:52:46 -0700, zamoph...@hotmail.com (Jim Z) wrote:

Quote
>I am trying to recompile an existing project, but I keep getting the error:
>"[Error] ParseCode.pas(112): Undeclared identifier: 'VarArrayCreate'"
>Here is the snippet of code:

David C. Ullrich

Re:"Undeclared identifier: 'VarArrayCreate'"


Quote
zamoph...@hotmail.com (Jim Z) wrote in message <news:2036785c.0108150652.203fa3d1@posting.google.com>...
> I am trying to recompile an existing project, but I keep getting the error:
> "[Error] ParseCode.pas(112): Undeclared identifier: 'VarArrayCreate'"
> Here is the snippet of code:

> procedure TDistrictParse.Button1Click(Sender: TObject);
> var ExcelApp, ExcelWK, NewExcelWK: variant;
>     SheetI, SheetExtent : integer;
>     DMList, UserList : variant;
>     BufStr, BufStr2 : string;
>     Listi : integer;
>     ExistID : integer;
>     ZipStr : string;
>     ZipFile : textfile;
> begin
>  excelapp:=createoleobject('Excel.Application');
>  excelapp.displayalerts:=false;
>  excelwk:=excelapp.workbooks.open(dmmap);
>  bufstr:=excelwk.sheets['useridmap'].cells[2,1].value;
>  sheetextent:=2;
>  while bufstr<>'' do
>  begin
>   bufstr:=excelwk.sheets['useridmap'].cells[sheetextent, 1].value;
>   inc(sheetextent);
>  end;
>   dec(sheetextent, 2);
>   DMList := VarArrayCreate([1, sheetextent], varVariant);  <-- error here
>   UserList:=vararraycreate([1, sheetextent], varVariant);  <-- error here
>  for listi:=1 to sheetextent do

> Any ideas?  Thanks in advance!

Is it possible I'm missing something in my "uses" statement?  I have:
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComObj, ComCtrls, StdCtrls;

Is this correct?

Re:"Undeclared identifier: 'VarArrayCreate'"


try to add variants to your uses clause if use delphi6

--
Vladimir Alexandrov
<valexand...@hotmail.com>
ICQ # 86729605

Re:"Undeclared identifier: 'VarArrayCreate'"


Hello, "Jim Z" <zamoph...@hotmail.com>! You wrote:
Quote
> zamoph...@hotmail.com (Jim Z) wrote in message

<news:2036785c.0108150652.203fa3d1@posting.google.com>...

Quote
> > I am trying to recompile an existing project, but I keep getting the
error:
> > "[Error] ParseCode.pas(112): Undeclared identifier: 'VarArrayCreate'"
> > Here is the snippet of code:

> Is it possible I'm missing something in my "uses" statement?  I have:
> uses
> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
> ComObj, ComCtrls, StdCtrls;

> Is this correct?

Try to add System. According to help VarArrayCreate funtion in my Delphi5
lives there.

--
    Evgeny V. Levashov, software developer,
    ICQ UIN 34864288
    Mebel Massiv Co, Tula, Russia
    http://home.tula.net/mebelmassiv

Re:"Undeclared identifier: 'VarArrayCreate'"


On Thu, 16 Aug 2001 10:19:13 +0400, "Evgeny V. Levashov"

Quote
<eug...@mebelmassiv.tula.ru> wrote:
>Hello, "Jim Z" <zamoph...@hotmail.com>! You wrote:
>> zamoph...@hotmail.com (Jim Z) wrote in message
><news:2036785c.0108150652.203fa3d1@posting.google.com>...
>> > I am trying to recompile an existing project, but I keep getting the
>error:
>> > "[Error] ParseCode.pas(112): Undeclared identifier: 'VarArrayCreate'"
>> > Here is the snippet of code:

>> Is it possible I'm missing something in my "uses" statement?  I have:
>> uses
>> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
>> ComObj, ComCtrls, StdCtrls;

>> Is this correct?

>Try to add System. According to help VarArrayCreate funtion in my Delphi5
>lives there.

If it's in System then it doesn't need to be added - System is
included automatically. It could be in some other unit in some
other version of Delphi, which is why the thing to do is to
check the docs and see what unit it actually is in.

Quote
>    Evgeny V. Levashov, software developer,
>    ICQ UIN 34864288
>    Mebel Massiv Co, Tula, Russia
>    http://home.tula.net/mebelmassiv

David C. Ullrich

Other Threads