Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dealing with #VALUE! Maracay Excel Discussion (Misc queries) 3 February 10th 09 03:35 PM
dealing with a projection Larry Holt Charts and Charting in Excel 0 February 15th 06 04:03 PM
Please include fonts from previous versions ('98) in new versions JJBQ Excel Discussion (Misc queries) 3 October 8th 05 07:19 PM
Dealing with Ranges Dean Goodmen Excel Programming 7 November 21st 04 03:29 PM
Dealing with pop-ups Jasons Excel Programming 1 November 7th 04 07:43 PM


All times are GMT +1. The time now is 10:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"