Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Probleme mit Excel2007 (https://www.delphipraxis.net/96474-probleme-mit-excel2007.html)

hermidelphi 25. Jul 2007 06:39


Probleme mit Excel2007
 
Hallo

Ich habe folgendes Problem:

In meiner Anwendung erzeuge ich eine Excel-Datei, läuft ohne Probleme mit Excel2003.
bei Excel2007 erscheint folgender Fehlercode. OLE-Fehler 800A03FC.

Delphi-Quellcode:
// Excel Applicationsfile erzeugen
DateiKopieren('empty.xls',GetCurrentDir + '\Arbeitszeit\Arbeitszeit_' + DateToStr(Datum.DateTime) + '.xls');

// Excel Application starten und Exceldokument oeffnen
ExcelApplication1.Connect;
ExcelApplication1.Visible[GetUserDefaultLCID] := true;
ExcelApplication1.UserControl := True;
ExcelApplication1.Workbooks.Open(GetCurrentDir + '\Arbeitszeit\Arbeitszeit_' + DateToStr(Datum.DateTime) + '.xls', False, False, EmptyParam, '', False, False, EmptyParam, EmptyParam, false, false, EmptyParam, EmptyParam, EmptyParam, false, 0);

// Workbook verbinden
ExcelWorkbook1.ConnectTo(ExcelApplication1.ActiveWorkBook);

// Workbookeigenschaften einstellen
ExcelWorkbook1.Title[1] := 'Arbeitszeiterfassung ' + datetimetostr(now);
ExcelWorkbook1.Author[1] := 'automatisch generiert';
ExcelWorkbook1.Save;

// Worksheet verbinden und aktivieren
ExcelWorksheet1.ConnectTo(ExcelWorkbook1.Sheets.Item[1] as _Worksheet);
ExcelWorksheet1.Activate;
Was mache ich falsch?

mfg
hermidelphi

toms 25. Jul 2007 06:44

Re: Probleme mit Excel2007
 
Hallo

Bei welcher Zeile kommt denn der Fehler? (oder sollten wir das herausfinden?)

hermidelphi 25. Jul 2007 06:54

Re: Probleme mit Excel2007
 
DFer Fehler kommt in Zeile:

Delphi-Quellcode:
// Workbook verbinden
ExcelWorkbook1.ConnectTo(ExcelApplication1.ActiveWorkBook);

hermidelphi 25. Jul 2007 08:22

Re: Probleme mit Excel2007
 
Hat keiner eine Idee, ich komme einfach nicht weiter.

mfg
hermidelphi

hoika 25. Jul 2007 08:53

Re: Probleme mit Excel2007
 
Hallo,

gugg mal da auf den Link im 2. Artikel

http://entwickler-forum.de/showthread.php?t=17405

Ich würde mal probieren

WorkBooks(1).Activate

WorkBooks ist die Workbooks-Collection.


Heiko

hermidelphi 25. Jul 2007 09:17

Re: Probleme mit Excel2007
 
Hallo Leute

Ich habe die Lösung gefunden. In der Anwendung werden Excel-Dateien mit .xls generiert. Bei Excel2007 muss es aber .xlsx sein.

mfg
hermidelphi

PS: Immer mal wieder was neues bei Bill


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:03 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