Board index » delphi » Excel automation problem in early binding

Excel automation problem in early binding

Hi , I am trying to use D5 with excel but do not succeed so far

this is wat I try
I put a component ExcelApplication1 on the form with autoconnect = true

Then I link the code to a button :
procedure TForm1.Button1Click(Sender: TObject);
var
  WBk: _Workbook;
  LCID :integer;
begin
  LCID :=GetUserDefaultLCID;
  ExcelApplication1.Visible[LCID] := TRUE;

When I click on it I receive a message saying that it is an old library or
an invalid type library.
I am using Excel 97 SR2 and Windows98.I can see that Excel is running in the
task kist but it is not visible.

Could someone give me a hint

Serge.Re...@freeworld.be

 

Re:Excel automation problem in early binding


Does this work?

Excel.Visible [0] := True;

--
Binh Ly
Need help on COM development?
http://www.techvanguards.com

Quote
Serge Rethy <serge.re...@gate71.be> wrote in message

news:89hcm6$k0s10@bornews.borland.com...
Quote
> Hi , I am trying to use D5 with excel but do not succeed so far

> this is wat I try
> I put a component ExcelApplication1 on the form with autoconnect = true

> Then I link the code to a button :
> procedure TForm1.Button1Click(Sender: TObject);
> var
>   WBk: _Workbook;
>   LCID :integer;
> begin
>   LCID :=GetUserDefaultLCID;
>   ExcelApplication1.Visible[LCID] := TRUE;

> When I click on it I receive a message saying that it is an old library or
> an invalid type library.
> I am using Excel 97 SR2 and Windows98.I can see that Excel is running in
the
> task kist but it is not visible.

> Could someone give me a hint

> Serge.Re...@freeworld.be

Re:Excel automation problem in early binding


Hi,
Yes this is working.

If I replace all lcid's everywhere with 0 then it is working !
Thanks for your hint
Do you know why this is working ?

It seems to be happening when Delphi 4 and 5 are both installed (first4 then
5)
on an other PC with NT4 and D5 it's working fine with LCID

Serge

"Binh Ly" <b...@castle.net> a crit dans le message news: 38bf31ef@dnews...

Quote
> Does this work?

> Excel.Visible [0] := True;

> --
> Binh Ly
> Need help on COM development?
> http://www.techvanguards.com

> Serge Rethy <serge.re...@gate71.be> wrote in message
> news:89hcm6$k0s10@bornews.borland.com...
> > Hi , I am trying to use D5 with excel but do not succeed so far

> > this is wat I try
> > I put a component ExcelApplication1 on the form with autoconnect = true

> > Then I link the code to a button :
> > procedure TForm1.Button1Click(Sender: TObject);
> > var
> >   WBk: _Workbook;
> >   LCID :integer;
> > begin
> >   LCID :=GetUserDefaultLCID;
> >   ExcelApplication1.Visible[LCID] := TRUE;

> > When I click on it I receive a message saying that it is an old library
or
> > an invalid type library.
> > I am using Excel 97 SR2 and Windows98.I can see that Excel is running in
> the
> > task kist but it is not visible.

> > Could someone give me a hint

> > Serge.Re...@freeworld.be

Re:Excel automation problem in early binding


<<Serge Rethy:
If I replace all lcid's everywhere with 0 then it is working !
...
Do you know why this is working ?

Quote

This MS article might explain it (found on the msdn site):

SYMPTOMS
When writing VBScript code that performs Automation to a US-English
version of Microsoft Excel 97, if the regional settings of the client
machine are not set to US English, the following error might occur:

Old format or invalid type library

CAUSE
The reason for the error is that the VBScript engine that ships with
Internet Explorer 4.0 uses the regional settings of the client machine
to pass a locale identifier (LCID) to the GetIDsOfNames method of
Excel's IDispatch interface. Excel attempts to load a type library
specific to the language identified, and this causes the above error
if no such version of the type library exists on the client machine.

STATUS
The problem has been fixed in version 5.0 of the Microsoft VBScript
engine (VBScript.dll) that ships with Internet Explorer 5.0. To
download a copy of IE5, go to the following Web site:

http://www.microsoft.com/windows/ie

Users of IE3/4 can solve the problem by upgrading their scripting
engines. To do so, go to the Microsoft Scripting Web site and choose
to download the Microsoft Scripting Engines Version 5.0:

http://msdn.microsoft.com/scripting

MORE INFORMATION
Automation servers use LCIDs to localize property/method names so
developers can write Automation code in a language other than US
English. In earlier versions of Excel (such as Excel 95), if the LCID
was not recognized or the appropriate library was not found, the
default language would be used. Because it was determined that a
client would be unable to tell whether a call failed because of the
LCID or for some other reason, the behavior was changed for Excel 97
to explicitly return an error if the LCID is not valid. It is then up
to the client to check for the error and request the default languange
if the LCID was incorrect.

Version 5.0 of the VBScript engine was modified to capture this type
of error and request the default language if an Automation server does
not support the LCID made from the client's regional settings.

? Microsoft Corporation 1999, All Rights Reserved.
Contributions by Richard R. Taylor, Microsoft Corporation

--
Deborah Pate

Other Threads