I am writing a script that will do one thing if outlook is installed, and do another if outlook isn’t installed. I tried all kinds of logical file checks etc to see if the outlook binaries existed, but it got complicated.
I decided to see if the outlook object would successfully initialize. If I cannot connect to the outlook application, then I can probably assume that outlook is not installed:
on error resume next
Set objOutlook = CreateObject("Outlook.Application")
If objOutlook Is Nothing Then
wscript.echo "Outlook 2007 is NOT installed, or is not installed correctly!"
else
wscript.echo "Outlook 2007 is installed on this PC."
end if
Your code will detect if any versionof Outlook is installed, not just Outlook 2007.
Here is what I did, with your idea as the starting point:\’*****************************************dim xdim OutlookVerOn Error Resume Nextset Outlook = Createobject("Outlook.Application")if not Err.Number then x = instr(1, Outlook.Version, ".") OutlookVer = left(Outlook.Version, x) + mid(Outlook.Version, x+1, 1)else OutlookVer = "0" RegNewKey = "" RegReplyKey = ""end if\’*********************************This will give you the Outlook version (Outlook 2007 reports 12.0, Outlook 2003 reports 11.0, etc). If Outlook is not installed, it should report 0, although I haven\’t tested that condition. It has worked successfully for both O2007 and O2003, and should for any version of Outlook.