I'd opt for another solution as presented by Joel Leach:
(I should have added the link)
Code:
Local lcRun
lcRun = [Run /n "] + ("<<full path to>>\Excel.exe") + [" /automation -Embedding]
&lcRun
You don't get an object reference loExcel this way, what it does is registering that specific Excel in memory. After that the second part should find that Excel version:
Code:
#DEFINE MYCOMOBJECT_CLSID = "{00024500-0000-0000-C000-000000000046}"
loMyComObject = CreateObjectEx(MYCOMOBJECT_CLSID, GetEnv("COMPUTERNAME"))
and put together with another detail about LockSetForegroundWindow:
Code:
#DEFINE EXCEL_CLSID "{00024500-0000-0000-C000-000000000046}"
Local lcRun, loMyComObject
DECLARE INTEGER LockSetForegroundWindow IN user32 INTEGER uLockCode
LockSetForegroundWindow(1) && lock
lcRun = [Run /N "<<full\path\to>>\Excel.exe" /automation -Embedding]
&lcRun
loMyComObject = CreateObjectEx(EXCEL_CLSID, GetEnv("COMPUTERNAME"))
LockSetForegroundWindow(2) && unlock
Where you replace <<full\path\to>> with the full path to Excel.
Once that's run that Excel version will be known by the general Excel CLSID. So swapping out the EXE determines which version starts, without manipulating the LocalServer32 key.
All in all this also will work, if a user used any Excel version beforehand, because that doesn't start Excel with the /automation - Embedding command line switches, but the first run of an Excel.Application COM server will do the same and determine what COM server is known by that in memory registered COM class.
In short, make a first try after restarting your computer and see if it works at all. Joel has a tip if Excel wouldn't work by this command line switches to look for the commandline the task manager shows.
If your application needs to run both Excel versions for different features, in the long run it would be better to adapt all code running with the newer Excel, I think. I doubt you can easily switch between excel versions, as running the EXE with the /automation -Embedding switches triggers a CoRegisterClassObject() but running the other EXE doesn't unregister what the first run put into memory.
If you don't understand what I mean by that, you should now read Joels article and then come back.
Edit: Good news, it works with my own "my.application" COM Server, but the RUN /N part of the code causes a my.exe to remain in the task manger, even when releasing loMyComObject. I think that's not a big problem, though, and may not even be the same with Excel.Exe.
Chriss