Carlos Posted December 7, 2007 Posted December 7, 2007 I want to read out the path where excel is installed. Is this possible?
JerryD Posted December 7, 2007 Posted December 7, 2007 With Office 2003, the default value of the key "HKEY_CLASSES_ROOT\Applications\EXCEL.EXE\shell\edit\command" has the full path to Excel. The entry is actually "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" /e, so you'd need to strip out the quotes and the trailing /e like this:$ExcelPath = RegRead ( 'HKEY_CLASSES_ROOT\Applications\EXCEL.EXE\shell\edit\command', '' ) If StringLeft ( $ExcelPath, 1 ) = '"' Then $ExcelPath = StringTrimLeft($ExcelPath,1) EndIf $ExcelPath = StringTrimRight( $ExcelPath, StringLen($ExcelPath)-StringInStr($ExcelPath,'"',1)+1 ) MsgBox ( 0, @ScriptName, $ExcelPath )
weaponx Posted December 7, 2007 Posted December 7, 2007 (edited) JerryD - Good solution for certain versions of OfficeUnfortunately mine doesn't have command line parameters.This is more fool proof.;Returns path with trailing backslash $excelFolder = RegRead ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe", "Path" ) If StringRight($excelFolder, 1) <> "\" Then $excelFolder &= "\" $excelPath = $excelFolder & "excel.exe" Edited December 7, 2007 by weaponx
JerryD Posted December 7, 2007 Posted December 7, 2007 You're absolutely right! App Paths is EXACTLY where to check. I stand corrected.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now