views:

2802

answers:

6

Where is a reliable registry key to find install location of Excel 2007?

A: 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Excel\InstallRoot\

Travis Collins
This is not on all my systems.
Jason
+3  A: 

How about:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\X.0\Common\InstallRoot]

which contains a key named 'Path' with the installation directory of that version of Office. This is consistent for Excel 8.0 through 12.0. If you want to look for a specific product, use Excel, Word, Access, etc., in place of Common.

  • Jon ------- Jon Peltier, Microsoft Excel MVP

From: http://www.developersdex.com/vb/message.asp?p=2677&r=6199020

Remou
This is not in all my systems that have Excel 2007.
Jason
A: 

Here is another direction you can go. I have not tested this.

http://support.microsoft.com/kb/240794

Travis Collins
+1  A: 

I have found this key to be consistent across all my Office 2007 installations.

[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\9B905EB838DBFEE4991CF8E66F518BBF]

If you are reading this, and you have Excel 2007, can you Vote this up (or leave a comment) if it is reliable for you too? (Vote it down, or post a comment if it is wrong?)

NOTE: This is not consistent across my machines.

[HKLM\SOFTWARE\Microsoft\Office\X.0\Common\InstallRoot]
Jason
It exists for me.
sascha
A: 

I'm using the following key:

[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe]

If the folder name contains Office12, you've got 2007. I'm using this method to decide during installation to install Office 2000-2003 addins or Office 2007 addins, as well as the folder to install them to.

This is extremely reliable, and also works well with localized versions of Windows. So far we've tested on French, German, Spanish and Italian with much better success than the other methods we were previously using. XLSTART should be the same in all languages, but be wary when developing word addins as "STARTUP" is localized in some cases.

sascha
I have Excel 2007 and I do not have this key. :( I have up to \App Paths, but no excel.exe listing.
Jason
A: 

Just remember if you're using the Automation technique hinted by Travis that Office can be a pig at locking itself with modal dialog boxes so appears hung to COM!

Robbo