AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Die letzte gefüllte Zeile finden

Ein Thema von sunshine-girl87 · begonnen am 10. Jul 2004 · letzter Beitrag vom 22. Aug 2004
Antwort Antwort
Benutzerbild von TheMiller
TheMiller

Registriert seit: 19. Mai 2003
Ort: Gründau
2.480 Beiträge
 
Delphi XE7 Architect
 
#1

Re: Die letzte gefüllte Zeile finden

  Alt 10. Jul 2004, 16:34
Habe den Code jetzt so abgeändert, da die Excel-Datei schon bekannt, geöffnet und in Gebrauch ist. Die Fehlermeldung lautet:

Ungültiger Index.

Delphi-Quellcode:
var
  myExcel, sheet: OLEVariant;
  zeile: Integer;
begin
  myExcel := CreateOleObject('Excel.Application');

    // Sheet := XLApp.Workbooks[1].WorkSheets[1];
    Sheet := myExcel.Workbooks[ExtractFilePath(ParamStr(0))+'Mappe1.xls'].WorkSheets[1];

    // In order to know the dimension of the WorkSheet, i.e the number of rows
    // and the number of columns, we activate the last non-empty cell of it

    Sheet.Cells.SpecialCells(xlCellTypeLastCell, EmptyParam).Activate;

    //myExcel.ActiveCell.Row;

   Result := myExcel.ActiveCell.Row;

   // Excel wieder schließen
   myExcel.DisplayAlerts := False;
   myExcel.Quit;
   myExcel := Unassigned;
   Sheet := Unassigned;
  end;
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:11 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz