Board index » delphi » D3-Excel :EOleSysError 'Unknown language'

D3-Excel :EOleSysError 'Unknown language'

Problem :   EOleSysError 'Unknown language'

Please give me a hint by email how to solve my 'unknown language'
OLE problem. I am using Delphi302 Pro and Excel95 (v7).

Thanks,
ho...@hl.telia.no

Code samples enclosed...

-----------------------------------------------------------

Delphi302 Pro  Code :
....
Uses ComObj;

procedure TForm1.ExcelStartClick(Sender: TObject);
// Test av Excel Ole2, Unknown language problem
// XLApplication def as variant in Form private section
begin
  try
     XLApplication := CreateOleObject('Excel.Application');  // req ComObj
unit
  except
     MessageDlg('Can not start MS Excel',mtError,[mbOK],0);
  end;
  // CODE WORKS FINE THIS FAR, Excel App has been created
  // -------------------------------------------
  XLApplication.Workbooks.Add;  // Raises error : EOleSysError 'Unknown
language'
  XLApplication.Worksheets('sheet1');
  XLApplication.Range('a1:b4').Formula:='=rand()';
  XLApplication.Sheets('sheet2').Activate;
  XLApplication.ActiveWorkbook.SaveAs('c:\temp\Temp.xls'); // hardcoded 4
test purpose only
end;
-----------------------------------------------------------

Macro tested in Excel95 (Excel v 7) UK version
Code works fine

' Macro1 Macro
' Macro recorded 23.03.1999 by holeg
' EXCEL VBA macro test for Delphi Ole Control by holeg
' Tested in Excel for tranlation to Delphi3 OLE Control

Sub Macro1()
    Workbooks.LeggTil
    ActiveWorkbook.Author = "holeg"
    Workbooks("Mysheet.xlt").Worksheets("sheet1").Activate
    Worksheets ("sheet1")
    Range("A1:C14").Font.Size = 18
    Range("a1:b4").Formula = "=rand()"
    Sheets("sheet2").Activate
    File1 = "c:\temp\Test.xls"
    ActiveWorkbook.SaveAs (File1)   ' works ok
End Sub
-----------------------------------------------------------

 

Re:D3-Excel :EOleSysError 'Unknown language'


[CAUTION: This message is sent both to original author thru email and to
newsgroups. Watch your "Reply" (all/group/message) command]

Hey Geir,

Quote
>// XLApplication def as variant in Form private section
>begin
>  try
>     XLApplication := CreateOleObject('Excel.Application');  // req ComObj
>  except
>     MessageDlg('Can not start MS Excel',mtError,[mbOK],0);
>  end;
>  // CODE WORKS FINE THIS FAR, Excel App has been created
>  // -------------------------------------------
>  XLApplication.Workbooks.Add;  // Raises error : EOleSysError 'Unknown

I really don't know for Norway (.no is Norway, isn't it?) but I know that
the FR version of Office7 had its Automation objects with translated
methods (in French!!!), making it impossible to use US methods. It may even
be the case in Office97FR... Didn't check Office2000 betas. This may
explain your "unknown language" stuff: the IDispatch interface that is
underlying for Automation finds out the LCID for "Workbooks" and/or "Add"
is US English, and it is not registered on your system...

This may be something totally different, but who knows? Still, you should
be able to automate according to your VBA Object Model doc, so if it says
"Workbooks.Add..." I dunno.

Good luck,

--
Christophe Porteneuve / Delphi Developer's Guild
Regional Vice-President - Paris, France
Director of Education
Email: christo...@delphiguild.com

Re:D3-Excel :EOleSysError 'Unknown language'


In article <7ddft9$qd...@forums.borland.com>, Christophe Porteneuve
(christo...@delphiguild.com) says...

Quote
> I really don't know for Norway (.no is Norway, isn't it?) but I know that
> the FR version of Office7 had its Automation objects with translated
> methods (in French!!!), making it impossible to use US methods. It may even
> be the case in Office97FR...

Yes, .no is Norway.

Yes, the problem is that the Office 95 line had all IDispatch methods
translated. I believe you can get around this by importing the typelib.
That's not as easy as it sounds, since the IDispatch methods contains the
extra norwegian letters which aren't allowed in Delphi... So you'll have
to extract the TLB using OLEView for instance (part of Visual Studio),
and then translate the IDL code to Pascal (possibly by hand). Very nice!
We gave up that, and instead figured out the (norwegian) method names.
But we used Word, so that won't help you...

No, Office 97 doesn't have the problem. It's supposed to handle both the
'user native' language (in this case norwegian) as well as the 'Office
native' language (US english).

M.

--
Ettertraktet kaffe, er det ekstra god kaffe?
mailto:martin.lars...@delfidata.no.NOSPAM
http://www.delfidata.no/users/~martin

Re:D3-Excel :EOleSysError 'Unknown language'


Thanks for all hints so  far

I  have to add the following info in this case as follows :
My office95 package was purchased in London and is not a Norwegian
translation. My Win95 I got in the US along with the PC.

My keyboard has been set to Norwegian -  however, all other sw is US
or UK versions - according to my personal preferences and my job
relations.

Thanks,
Geir

On Thu, 25 Mar 1999 16:54:49 +0100, martin.lars...@delfidata.no.NOSPAM

Quote
(Martin Larsson) wrote:
>In article <7ddft9$qd...@forums.borland.com>, Christophe Porteneuve
>(christo...@delphiguild.com) says...
>> I really don't know for Norway (.no is Norway, isn't it?) but I know that
>> the FR version of Office7 had its Automation objects with translated
>> methods (in French!!!), making it impossible to use US methods. It may even
>> be the case in Office97FR...

>Yes, .no is Norway.

>Yes, the problem is that the Office 95 line had all IDispatch methods
>translated. I believe you can get around this by importing the typelib.
>That's not as easy as it sounds, since the IDispatch methods contains the
>extra norwegian letters which aren't allowed in Delphi... So you'll have
>to extract the TLB using OLEView for instance (part of Visual Studio),
>and then translate the IDL code to Pascal (possibly by hand). Very nice!
>We gave up that, and instead figured out the (norwegian) method names.
>But we used Word, so that won't help you...

>No, Office 97 doesn't have the problem. It's supposed to handle both the
>'user native' language (in this case norwegian) as well as the 'Office
>native' language (US english).

>M.

>--
>Ettertraktet kaffe, er det ekstra god kaffe?
>mailto:martin.lars...@delfidata.no.NOSPAM
>http://www.delfidata.no/users/~martin

Other Threads