Thema: Delphi Schleife abbrechen...

Einzelnen Beitrag anzeigen

horst

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

Re: Schleife abbrechen...

  Alt 14. Nov 2003, 11:52
irgendwie klappt das nicht auch wenn ich den button anklicke:

habe es so gemacht:

Delphi-Quellcode:
procedure TForm1.Button2Click(Sender: TObject);
var
  ndx: Integer;
begin
  ndx := 1;
  abbruch := true;
  while (ndx < StringGrid1.RowCount - 1) and (not abbruch) do
  begin
    inc(ndx);
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  FileName: OleVariant;
  i, j: Integer;
  s: string;
begin
  Application.ProcessMessages;
  for i := 0 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(3000);
      WordDocument1.Disconnect;
    end;
  end;
end;
  Mit Zitat antworten Zitat