Listing 4: findxl.vbs Figuring out if Excel is installed
Option Explicit Public installer, state, path Const msiInstallStateDefault = 5 ' Connect to Windows Installer object set installer = Wscript.CreateObject("WindowsInstaller.Installer") state = installer.productstate _ ("{00000409-78e1-11d2-b60f-006097c998e7}") if state <> msiInstallStateDefault then MsgBox ("Office not Installed " & state) Wscript.quit end if path = installer.ComponentPath _ ("{00000409-78E1-11D2-B60F-006097C998E7}", _ "{CC29E96F-7BC2-11D1-A921-00A0C91E2AA2}") if path <> "" then path = path & " Version " & installer.FileVersion (path, false) end if msgbox path