Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Wbk.sheets.Add für Excel 2013 (https://www.delphipraxis.net/209108-wbk-sheets-add-fuer-excel-2013-a.html)

Alfredo 27. Okt 2021 11:54

Wbk.sheets.Add für Excel 2013
 
Folgendes funktioniert:

Excel wird angezeigt und die Tabelle2 ist aktiv.

Delphi-Quellcode:
Var
Wbk: _Workbook;
WS1: _Worksheet;
WS2: _Worksheet;
lcid: Integer;

procedure Tform1.Button1.Click(Sender: TObject);

begin

ExcelApplication1.Connect;
Excelapplication1.Visible[GetUserDefaultlcid] := True;

Wbk := ExcelApplication1.Workbooks.Open('X:\firebird30\FBexport_1.xls',
False,Flase,EmptyParam,'',False, False, EmptyParam, EmptyParam,
False,False,EmptyParam,EmptyParam,EmptyParam,False,0);

WS1 := Wbk.Worksheets.ITEM['FBexport_1'] as _Worksheet;
WS2 := Wbk.Worksheets.ITEM['Tabelle2'] as _Worksheet;
WS2.Activate(lcid);

end;
mit
Delphi-Quellcode:
Wbk.Sheets.Add(NULL,NULL,NULL,EmptyParam,lcid);
wird an erster Stelle eine neue Tabelle eingefügt.
Was laut Definition wenn Before und After nicht angegeben sind so richtig ist.

Eine Tabelle rechts anfügen bekomme ich jedoch nicht hin.

Gruß
Alfred

Delphi.Narium 27. Okt 2021 12:11

AW: Wbk.sheets.Add für Excel 2013
 
Doku? https://docs.microsoft.com/de-de/off...cel.sheets.add

Chemiker 27. Okt 2021 13:57

AW: Wbk.sheets.Add für Excel 2013
 
Hallo,

vielleicht hilft das weiter:

https://www.delphipraxis.net/190397-excel-sheets.html

Bis bald Chemiker

Alfredo 27. Okt 2021 21:49

AW: Wbk.sheets.Add für Excel 2013
 
Vielen Dank für eure Hinweise.

Die Doku passt leider für ExcelXP nicht.
Laut automatischer Ergänzung sind es 5 Parameter.
Beim 1. Beispiel fehlt m.E. eine '( )'.
Das 2. Beispiel wird zwar kompiliert, liefert aber einen Laufzeitfehler "Exception der Klasse OELSysError
mit der Meldung 'Mitglied nicht gefunden' aufgetreten".

Ich dachte ich bräuchte für Excel2013 ExcelApplication1.

ComObj in die uses und alles funktioniert wieder wie in alten Tagen.

Gruß
Alfred


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:16 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz