This InnoSetup code is working for me under Win 10x64 and Office 2016 x86 (using 'HKLM\SOFTWARE\Microsoft\Office\ClickToRun\Configuration' and key 'Platform')
[Code]
const
RegOffice='SOFTWARE\Microsoft\Office\ClickToRun\Configuration';
RegOfficeKey='Platform';
/// <summary>
/// Get current HKLM version
/// </summary>
function GetHKLM: Integer;
begin
if IsWin64 then
Result := HKLM64
else
Result := HKLM32;
end;
/// <summary>
/// Check is Microsoft Office is installed or not
/// </summary>
function IsOfficeInstalled (): Boolean;
var
platform: string;
begin
RegQueryStringValue(GetHKLM(), RegOffice, RegOfficeKey, platform);
if platform = 'x86' then begin
SuppressibleMsgBox('Microsoft Office found (x86 version)' , mbConfirmation, MB_YESNO or MB_DEFBUTTON1, IDYES);
Result := True;
end else if platform = 'x64' then begin
SuppressibleMsgBox('Microsoft Office found (x64 version)', mbConfirmation, MB_YESNO or MB_DEFBUTTON1, IDYES);
Result := True;
end else begin
SuppressibleMsgBox('Microsoft Office NOT found' + platform + '.', mbConfirmation, MB_YESNO or MB_DEFBUTTON1, IDYES);
Result := False;
end;
end;