Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Ungültiger Variant-Operation? (https://www.delphipraxis.net/20362-ungueltiger-variant-operation.html)

schuetze09 16. Apr 2004 15:29


Ungültiger Variant-Operation?
 
Hallo zusammen,

ich erhalte eine Fehlermeldung zu diesem Abschnitt.

"Ungültig Variant-Operation"

Was ist hier falsch?

Delphi-Quellcode:
  if ConnectToExcel = True
    then begin
           ExcelApp.WorkBooks.Open(LoadFromIniFile('FILE', 'Neu'));
           ExcelApp.DisplayAlerts := False;
           Cursor:=crHourGlass;
           Application.ProcessMessages;
           for i:=15 to 43
           do begin
                if ExcelApp.Range['B'+IntToStr(i), 'B'+IntToStr(i)].Value = FormatDateTime('dd.mm.yyyy', now)
                  then begin
                         ExcelApp.Range['G'+IntToStr(i), 'G'+IntToStr(i)].Value :=FormatDateTime('hh:nn', Time);
                         ExcelApp.Save;
                         ExcelApp.Quit;
                         ExcelApp := Unassigned;
                       end;
              end;
           Cursor:=crDefault;
         end
    else exit;
MfG
schuetze09

shmia 16. Apr 2004 15:37

Re: Ungültiger Variant-Operation?
 
Delphi-Quellcode:
      for i:=15 to 43
           do begin
                if ExcelApp.Range['B'+IntToStr(i), 'B'+IntToStr(i)].Value = FormatDateTime('dd.mm.yyyy', now)
                  then begin
                         ExcelApp.Range['G'+IntToStr(i), 'G'+IntToStr(i)].Value :=FormatDateTime('hh:nn', Time);
                         // Falsch: die Schleife arbeitet weiter und du machst Excel zu
                         ExcelApp.Save;
                         ExcelApp.Quit;
                         ExcelApp := Unassigned; // <=== !!!
                       end;

schuetze09 16. Apr 2004 15:55

Re: Ungültiger Variant-Operation?
 
was soll ich da noch sagen, außer

DANKE

Das Problem ist gelöst!

MfG
schuetze09


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