Programming C# C++ (7) Delphi (617) .NET (2) Database (71) Delphi IDE (89) Network (39) Printing (3) Strings (12) VCL (83) Windows with Delphi (280) Java (8) JavaScript (31) perl (9) php (4) VBScript (1) Visual Basic (1)
Exchange Links About this site Links to us 
|
Determine the version of the Word installation
This article has not been rated yet. After reading, feel free to leave comments and rate it.
Question:
My Delphi application needs to verify that Microsoft Word is installed and it has to be at least Word version 2000. How can I do this?
Answer:
The function GetInstalledWordVersion creates a Word object and reads the version number from there. If creating the Word object fails, then Word is not (properly) installed, thus the function returns 0.
 | |  | |
uses
ComObj;
const
Wordnotinstalled = 0;
Wordversion97 = 8;
Wordversion2000 = 9;
WordversionXP = 10;
Wordversion2003 = 11;
function GetInstalledWordVersion : integer;
var
Word: OLEvariant;
begin
Result := 0; try
Word := CreateOLEObject('Word.Application');
Result := Word.version;
Word.Quit;
finally
Word := Unassigned
end;
end;
begin
if GetInstalledWordVersion < Wordversion2000 then
ShowMessage('You need a newer version of Word')
end. | |  | |  |
Comments:
|