Thema: Delphi Schleife abbrechen...

Einzelnen Beitrag anzeigen

horst

Registriert seit: 1. Jul 2003
347 Beiträge
 
Delphi 2007 Professional
 
#1

Schleife abbrechen...

  Alt 14. Nov 2003, 01:32
guten morgen
wer mag mir sagen wie ich diese schleife abbrechen kann?
  for i := 1 to StringGrid1.RowCount -1 do //Gesamt
Delphi-Quellcode:
procedure TForm1.Button8Click(Sender: TObject);
var
  FileName, NewFile: OleVariant;
  i, j: Integer;
  s: string;
begin
  for i := 1 to StringGrid1.RowCount -1 do
  begin
    s := StringGrid1.Cells[8, i];
    with TRegistry.Create do
   try
      RootKey := HKEY_CURRENT_USER;
      if OpenKey('\Software\VB and VBA Program Settings\FRITZ!fax\Print', True) then
      begin
        WriteString('Microsoft Word - test.doc', s);
        end;
    finally
      CloseKey;
      Free;
      WordApplication1.Connect;
      FileName := 'C:\test.doc';
      WordApplication1.Documents.Open(FileName, EmptyParam, EmptyParam, EmptyParam,
        EmptyParam, EmptyParam, EmptyParam, EmptyParam,
        EmptyParam, EmptyParam);
      WordDocument1.Close;
      WordApplication1.PrintOut;
      sleep(2000);
      WordDocument1.Disconnect;
    end;
  end;
end;
  Mit Zitat antworten Zitat