Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi OLE Automation mit Excel (https://www.delphipraxis.net/29688-ole-automation-mit-excel.html)

jority 13. Sep 2004 10:07


OLE Automation mit Excel
 
Hallo,
ich habe eine Adressen.XLS Datei, die ich ein wenig in Ordnung bringen will, sprich die Aufteilung der Daten verbessern...
Momentan sieht meine Prozedur so aus und ergibt folgenen Fehler:
"Ungültige Variant Operation"

so sieht die Prozedur aus:
Delphi-Quellcode:
var i, j: integer;
    excel: Variant;
    Adressen : Array of TAdressen;
    tempstring, Tempstring2:string;
begin
    Excel:= CreateOleObject('Excel.Application');
    Excel.visible:=True;
    Excel.Workbooks.open('C:\Eigene Dateien\Delphi\Christinck\Adressen.xls');

    //Weitere Infos dranhängen
    for i:=1 to 1950 do
    begin
      Tempstring:=copy(Excel.cells[i,1],1,6);
      if Tempstring='Email:' then
      begin
        Tempstring:=Excel.cells[i+1,1];
        If Tempstring='' then
        begin

        end
        else
        begin
          Excel.cells[i,2]:=Excel.cells[i,2]+' '+Tempstring; // <---Hier entsteht der Fehler
        end;
      end;
    end;
end;
Jemand ne Idee wie ich das anders machen kann?

gruß Jority

Christian Seehase 13. Sep 2004 18:53

Re: OLE Automation mit Excel
 
Moin Zusammen,

das Problem wurde von Jority selber gelöst.
Da diese Feststellung mit einer neuen Frage verknüpft wurde, habe ich das Thema geteilt.

Hier geht's dann weiter:

Spalte in Excel löschen


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