var x: string;
x:= ExcelApplication1.Range['A1','A1'].Value;
I get an 'OLE-Fehler 800A03EC'
What does this error numer 800A03EC express ??
bye
Stephan Hartmann
Very little - it is Excel's favourite error number. There
is nothing wrong with the code that you've shown, as far as
I know - can you show us the code preceding it?
--
Deborah Pate
here is an example code where I reduced my problem to the minimum.
With Button 1 Excel is started in the ole-container, button 2 should get the
contents of cell A1.
The compiled exe works fine with Excel 97, but generates an OLE-Error
800A03EC with Excel 2000,
when pressing the 2nd button.
It makes no difference if I use the delphi 5.0 components (excel97.pas) or
the delphi 5.01 version (excel2000).
Although an inserted ExcelApplication1.Connect before the ShowMessage has no
effect.
Regards
SoftSupport GmbH
i.A. Stephan Hartmann
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
OleCtnrs, StdCtrls, OleServer, Excel2000;
type
TForm1 = class(TForm)
oleExcel: TOleContainer;
Button1: TButton;
Button2: TButton;
ExcelApplication1: TExcelApplication;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
// start Excel on Buttonclick
begin
oleExcel.CreateObject('Excel.Sheet.8',FALSE);
oleExcel.DoVerb(ovShow)
end;
procedure TForm1.Button2Click(Sender: TObject);
// get Cell A1
begin
ShowMessage(ExcelApplication1.Range['A1','A1'].Value);
end;
end.
Deborah Pate <d.pate@cableinet.c
You're using an olecontainer! Don't use the
TExcelApplication object, then, it's asking for trouble.
Just use variables:
var
Excel, Sheet: olevariant;
..
Sheet := OleContainer1.OleObject;
Excel := Sheet.Application;
Sheet.Range['A1'].Value := 4;
--
Deborah Pate
when I try your code I get an error message (translated from german)
'Method 'RANGE' not supported from automatisation object'
I have modified it in the following way:
OleExcel.OleObject.Application.Range['A1'].Value:='2345';
ShowMessage(OleExcel.OleObject.Application.Range['A1'].Value);
My problem: it's working fine with Excel 97,but OLE-Error with Excel 2000
just like my original code
any ideas ?
bye
SoftSupport GmbH
i.A. S. Hartmann
If you start a new project, put a TOleContainer on it (but
no Excel components), and try the following code, where
does the error come?
var
Excel, WB, WS: OleVariant;
..
Olecontainer1.CreateObject('Excel.Sheet', False);
Olecontainer1.Doverb(ovPrimary);
WB := Olecontainer1.Oleobject;
Excel := WB.Application;
WS := WB.ActiveSheet;
Caption := WS.Name;
WS.Range['A1'].Value := 'First cell';
--
Deborah Pate
when I Did Your Code, suddenly it worked !
Well, when I looked at the differnces between the new and the old code,
I recognized that in Your code an 'ActiveSheet' is between application and
the Range.
Excel 97 isn't missing that, but Excel 2000 brings the error !
thanks for your help
Stephan
"Deborah Pate" <d.p...@cableinet.co.not-this-bit.uk> schrieb im Newsbeitrag
news:VA.0000016...@cableinet.co.not-this-bit.uk...