Einzelnen Beitrag anzeigen

ickehausen

Registriert seit: 29. Jul 2004
85 Beiträge
 
Delphi 2010 Enterprise
 
#1

Word beenden ohne Dokument zu speichern.

  Alt 10. Mär 2009, 08:38
Ich ersetze in ein Worddokument Textmarken mit Delphi, was auch gut funktioniert. Anschließend drucke ich es aus und möchte das Dokument ohne es zu speichern schließen. Im Moment mache ich es wie folgt:

Delphi-Quellcode:
procedure TFrmVernichtungsprotokoll.Druck;
var FileName:OleVariant;
    vWhat, vBookmark:OleVariant;
begin
  Filename := GetAPpPath + '\Vernichtung.doc';
  WordApplication1.Connect;
  WordApplication1.Documents.OpenOld(FileName, EmptyParam, EmptyParam,
  EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam,EmptyParam,
  EmptyParam);
  WordDocument1.ConnectTo(WordApplication1.ActiveDocument);
  WordApplication1.Visible := True;
  vWhat:=wdGoToBookmark;
  vBookmark:='Name';
  WordApplication1.Selection.GoTo_(vWhat,emptyParam,emptyParam,vBookmark);
  WordApplication1.Selection.TypeText(DMMain.IBDataSetPrint.FieldByName('NNAME').AsString);
  WordApplication1.PrintOut;
  WordDocument1.Close;
  WordDocument1.Disconnect;
end;
.
.
.
procedure TFrmVernichtungsprotokoll.Timer2Timer(Sender: TObject);
begin
  WordApplication1.Quit;
  WordApplication1.Disconnect;
end;
Leider wird das Dokument dann immer mit den Inhalten der Textmarken gespeichert. Wie kann ich dass Speichern verhindern?
Es gibt keine dummen Fragen ...
  Mit Zitat antworten Zitat