Hi.
Here is my code.:
procedure TForm1.Button1Click(Sender: TObject);
var
myWordApp: TWordApplication;
myFile, Savefile: OleVariant;
Doc: WordDocument;
begin
// Create an instance of Word application.
myWordApp := TWordApplication.Create(Self);
myFile := 'C:\SA08.doc';
SaveFile := 'C:\test.doc';
//Open a readonly document without displaying it.
Doc := myWordApp.Documents.Open(myFile, // filename
EmptyParam, // COnfirmConversion
EmptyParam, // REadonly
EmptyParam, // ADdToRecent
EmptyParam, // PasswordDocument
EmptyParam, // PasswordTemplate
EmptyParam, // Revert
EmptyParam, // WritePasswordDocument
EmptyParam, // WritePasswordTemplate
EmptyParam, // Format
EmptyParam, // Encoding
EmptyParam // Visible
);
//Opens word application with myFile.
//myWordApp.Visible := TRue;
//Saves the file without readonly.
Doc.SaveAs(SaveFile, // filename
EmptyParam, // fileformat
EmptyParam, // Lockcomments
EmptyParam, // Password
EmptyParam, // AddtoRecentFiles
EmptyParam, // WritePassword
EmptyParam, // ReadOnlyRecommended
EmptyParam, // EmbedTrueTypeFonts
EmptyParam, // SaveNativePictureFormat
EmptyParam, // SaveFormsData
EmptyParam // SaveAsAOCELetter
);
Doc.Close(EmptyParam,EmptyParam,EmptyParam);
//This will free the application from memory.
myWordApp.Quit;
The problem is that if I use myWordApp.Quit it will try to close any Word application that is allready open, but if I use other methods the Winword.exe will not be destroyed or killed in the memory....
Please help me...
Is there any solutions to my problem??
Many thanks if anyone could help.
Michael
Here is my code.:
procedure TForm1.Button1Click(Sender: TObject);
var
myWordApp: TWordApplication;
myFile, Savefile: OleVariant;
Doc: WordDocument;
begin
// Create an instance of Word application.
myWordApp := TWordApplication.Create(Self);
myFile := 'C:\SA08.doc';
SaveFile := 'C:\test.doc';
//Open a readonly document without displaying it.
Doc := myWordApp.Documents.Open(myFile, // filename
EmptyParam, // COnfirmConversion
EmptyParam, // REadonly
EmptyParam, // ADdToRecent
EmptyParam, // PasswordDocument
EmptyParam, // PasswordTemplate
EmptyParam, // Revert
EmptyParam, // WritePasswordDocument
EmptyParam, // WritePasswordTemplate
EmptyParam, // Format
EmptyParam, // Encoding
EmptyParam // Visible
);
//Opens word application with myFile.
//myWordApp.Visible := TRue;
//Saves the file without readonly.
Doc.SaveAs(SaveFile, // filename
EmptyParam, // fileformat
EmptyParam, // Lockcomments
EmptyParam, // Password
EmptyParam, // AddtoRecentFiles
EmptyParam, // WritePassword
EmptyParam, // ReadOnlyRecommended
EmptyParam, // EmbedTrueTypeFonts
EmptyParam, // SaveNativePictureFormat
EmptyParam, // SaveFormsData
EmptyParam // SaveAsAOCELetter
);
Doc.Close(EmptyParam,EmptyParam,EmptyParam);
//This will free the application from memory.
myWordApp.Quit;
The problem is that if I use myWordApp.Quit it will try to close any Word application that is allready open, but if I use other methods the Winword.exe will not be destroyed or killed in the memory....
Please help me...
Is there any solutions to my problem??
Many thanks if anyone could help.
Michael