This is basically a Delphi syntax issue. I need to set the True parameter when calling the OLE object method.
I need to install Word Automation (this is from the Word Reference ):
wdApp.Quit SaveChanges:=wdDoNotSaveChanges
As an example, consider a dummy procedure in which I would like to do this (pay attention to WordApp.Quit!):
Procedure GetWordVersion; var WordApp: OLEVariant; begin { Create the OLE Object } Try WordApp := CreateOLEObject('Word.Application'); WordVersion := WordApp.version; WordApp.Quit; // >-- HERE!!!! except on E: Exception do begin WordVersion := -1; end; End; end;
Here (check the accepted answer) the same seems to be done, but if I try this: it does not compile. I copy here only the relevant parts:
Const wdDoNotSaveChanges = 0 [...] wdo.Quit wdDoNotSaveChanges [...] End Function
Important: instead of using
// this is from Word Reference wdApp.Quit SaveChanges:=wdDoNotSaveChanges
can be used
// from Word Reference wdApp.NormalTemplate.Saved = True
Can someone modify my GetWordVersion procedure above to use one of the two approaches above? Thanks.
source share