Board index » delphi » OLE Excel and language

OLE Excel and language

Hi there =

I have a problem with excel and OLE2.

I want to get my program to work in excel 7.0 witch is language
dependent.

Now the trouble is that i have A norwegian Win95 versjon and English
Excel.  =

I get the all so commom 'unknown language' message!!

I want to get the english object library to work no matter what version
off win95 i have (or witch regional settings there is).

I have tried to include the typelib as a unit in delphi  and have
something like this:

var =

OLEEXcel :co_ExcelApplication;

Procedure OpeneXcel;
begin
OLEExcel.Create.Application;
OLEExcel.Create.Workbook(1).Open(Filename);

i got it to work with code completion in when i code my program but when
i run in the program halts in the project module:

you know the bit like this;

Application.Initialize;
Application.CreateForm (Form1:Tform);
Application.Run;

As soon as I include the EXCEL_TLB unit in my project the program stops
here with the error
"object or class type requried"

Now am I importing the typelib in a wrong way or do i fail in my atempt
to create an early binding ?

Now there is an earlier posting here concering the same problem with a
swedish win95. =

I do not have the norwegian type library and i dont wont i either i want
the english OLE calls to work all the time like in excel.8;

No my GUID is {00020813-0000-0000-C000-000000000046} and this points to
the XL5EN32.olb  so that should be right according to the tips from =

Chrsiter H=F8gstklint. =

What doese He (you) mean by adding a entry for it ??

help!!

Christian

 

Re:OLE Excel and language


On Wed, 29 Oct 1997 20:54:14 +0100, Leiv Terje Sangolt

Quote
<LEIV.T.SANG...@VESTA.NO> wrote:

>Now the trouble is that i have A norwegian Win95 versjon and English
>Excel.  =
>I get the all so commom 'unknown language' message!!

>I do not have the norwegian type library and i dont wont i either i want
>the english OLE calls to work all the time like in excel.8;

Its right, you dont want the Norwegian typelib. You just have to fool
Win95, so it thinks it has one. So in the registry add a level for the
norwegian language code (dont know it, sorry) and the win32 key
with the default value pointing at your english typelib

something like this.
Since you have the fjords i guess 42 is your language code :-)

under the GUID {00020813-0000-0000-C000-000000000046}
    1.0
         9   ( this should already be there )
            win32   =>   ..../XL5EN32.OLB

        42  ( Add this )
            win32   =>   ..../XL5EN32.OLB

Quote
>What doese He (you) mean by adding a entry for it ??

I guess that this is how it works, but it is just theories.
Since you have Norwegian Win, then when you do
CreateOleObject the systems scans the GUID entry in the registry and
and somehow chooses the version (1.0) then it takes the Primary
lanuage id youre are currently using and tries to find a key for it
and when it doesn't it says   'unknown language' . So what we do is to
provide a valid search path pointing at the typbelib we want it to
point at.

/Christer Hostklint
em:  christer.Hostklint at mitel.com

Re:OLE Excel and language


Quote
On Thu, 30 Oct 1997 09:00:03 GMT, (Christer H?stklint) wrote:
>On Wed, 29 Oct 1997 20:54:14 +0100, Leiv Terje Sangolt
><LEIV.T.SANG...@VESTA.NO> wrote:

>>Now the trouble is that i have A norwegian Win95 versjon and English
>>Excel.  =

>>I get the all so commom 'unknown language' message!!

>>I do not have the norwegian type library and i dont wont i either i want
>>the english OLE calls to work all the time like in excel.8;

>Its right, you dont want the Norwegian typelib. You just have to fool
>Win95, so it thinks it has one. So in the registry add a level for the
>norwegian language code (dont know it, sorry) and the win32 key
>with the default value pointing at your english typelib

>something like this.
>Since you have the fjords i guess 42 is your language code :-)

>under the GUID {00020813-0000-0000-C000-000000000046}
>    1.0
>         9   ( this should already be there )
>            win32   =>   ..../XL5EN32.OLB

>        42  ( Add this )
>            win32   =>   ..../XL5EN32.OLB

>>What doese He (you) mean by adding a entry for it ??

>I guess that this is how it works, but it is just theories.
>Since you have Norwegian Win, then when you do
>CreateOleObject the systems scans the GUID entry in the registry and
>and somehow chooses the version (1.0) then it takes the Primary
>lanuage id youre are currently using and tries to find a key for it
>and when it doesn't it says   'unknown language' . So what we do is to
>provide a valid search path pointing at the typbelib we want it to
>point at.

>/Christer Hostklint
>em:  christer.Hostklint at mitel.com

Well the entrykey is actyally 14. But this is not good prgraming.

Works fine if your are doing som coding as a hobbie but to distribute

a program that hacks the registry in that way ????

 QUICK and DIRTY!!!

now the really good solotion (im sad to say) is to use your language

dependent typelib.

Quote

This is ofcourse some overhead since you have to write your code in
two versions ig you want it to run on english or norwegian tables.

Another idea is to have a sort of a lookup table with the different
language depedent OLE calls and  in the code referer to this.

The only thing to change in your code is the refrence to the table
like first column has english syntax and the next has swedish and so
on (you need only create it for the OLE calls you use),

Changeing the lookuptable reference can be done at runtime

Christian
IT counsultant
BITS,Bergen
NORWAY

Re:OLE Excel and language


That sound fine. But what if you don't have the type library for this
language?
I have the same problem and it seems there's no way to get a romanian ( 4
example) typelib.

Black

bl...@berg.dnttm.ro

Other Threads