Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dealing with old higher versions in registry
Still trying to get a completely foolproof method to install a .xla add-in.
My currrent method goes like this in pseudo code: Get the path to the current Excel version from: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\App Paths\Excel.exe From this Excel.exe file get the file version number. This could be something like 10.0.2.26 From this get the registry Office version number, so something like 10.0, with some string manipulation. Remove any entries under the reg keys for that particular Office version: HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\E xcel\Add-in Manager HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\E xcel\Options Then run a simple VB6 exe like this: Sub Main() Dim oXL As Object Dim oAddin As Object Dim strLocalDrive As String Set oXL = CreateObject("Excel.Application") strLocalDrive = Left$(oXL.Path, 1) oXL.Workbooks.Add Set oAddin = _ oXL.AddIns.Add(strLocalDrive & _ "\RBSSynergyReporting\Program\SynergyReportingLoad er.xla", True) oAddin.Installed = True oXL.Quit Set oAddin = Nothing Set oXL = Nothing End Sub I thought that this would always work, but there is a problem when say the current Excel version is 9 and there is a reg key like for example: HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\E xcel\Options The VB6 exe then will give an error: Run-time error '-2147417851 (80010105)': Method '~' of object '~' failed And in fact the add-in gets installed in the registry under the higher Office version key. Deleting this spurious higher Office key will solve it but Excel will behave strange on the first startup after this. What would be the best way to avoid the above problem? My add-in installation is with an INNO script. Thanks for any advice. RBS |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dealing with #VALUE! | Excel Discussion (Misc queries) | |||
dealing with a projection | Charts and Charting in Excel | |||
Please include fonts from previous versions ('98) in new versions | Excel Discussion (Misc queries) | |||
Dealing with Ranges | Excel Programming | |||
Dealing with pop-ups | Excel Programming |