banerji
15th September 2004 05:23 UTC
Excel workbooks shortcuts
Hello,
My NSIS script creates shortcuts to MS Excel workbooks in the start menu folders. This is a piece of software for general release, so I don't know beforehand which version of Excel the end-user will be running.
The shortcuts are created as follows:
CreateShortCut "$SMPROGRAMS\...\Shortcut.lnk" "EXCEL.EXE" "$INSTDIR\Workbook.xls"
and the installation proceeds fine. However, clicking on the .lnk file from the Start Menu throws up a window telling me that Windows is searching for "Excel.exe".
Is there a way to dynamically find out which directory the "excel.exe" executable is located? I suspect one has to search the registry, but how? Also, could someone walk me through the process? Or point me to a pre-written macro?
Thanks in advance...
Davion
15th September 2004 15:28 UTC
in the Registry there is the path of every Office Application depending on the version, for Office 2000 the Path of Excel would be in
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\9.0\Excel\InstallRoot\Path
I think for Office 97 you have to change the 9.0 to 8.0 ascending with every Version
so You would have to check the RegKey for Office 97, if its empty for 2000
and so on.
the Path you get from there you write into a variable and create the shortcut like this:
CreateShortCut "$SMPROGRAMS\...\Shortcut.lnk" "$EXCELPATH\EXCEL.EXE" "$INSTDIR\Workbook.xls"
where $EXCELPATH is the Path you got out of the registry of course ;)
this should work
greetz Dave
btw: I used this way to find the path of ACCESS or the ACCESS Runtime in my Setup and it works fine for me
Comm@nder21
15th September 2004 19:32 UTC
CreateShortCut "$SMPROGRAMS\...\Shortcut.lnk" "$INSTDIR\Workbook.xls"
this should work.
Afrow UK
15th September 2004 19:34 UTC
Yes, you just want to target the xls document. Windows will do the rest (execute the xls Shell)
-Stu
banerji
16th September 2004 05:25 UTC
Yes, I just referred the link and Windows did the rest.
Thanks for the tips, guys.