PC Review


Reply
Thread Tools Rate Thread

Load Add-in's Without Using Add-in Manager

 
 
McRolin
Guest
Posts: n/a
 
      11th Mar 2004
Hello All,
I have built an Excel add-in (C++) containing a set of lognormal
distribution functions. I want to distribute the add-in but currently
require the user to open Excel and load the add-in using the add-in manager.
I would prefer to "add" the add-in to Excel's add-in list during my
installation. Is there away to automatically load the add-in without having
the user manually do it?

Thanks, Roger


 
Reply With Quote
 
 
 
 
Robin Hammond
Guest
Posts: n/a
 
      11th Mar 2004
Roger,

try this.

Sub InstallAddIn()
'this is a VB routine that runs as part of an external installation package
to register an add-in with xl
'this was based on something I saw in the groups I think, but apoligies to
original author since I cannot remember who it was

Dim strApp As String
Dim strAddInPath As String
Dim oAddin As Object
Dim oXL As Object
Dim nExcelCount As Integer

strApp = App.Path

nExcelCount = 0

TestForExcel:

On Error Resume Next
Set oXL = GetObject(, "Excel.Application")
On Error GoTo 0

If Not (oXL Is Nothing) Then

If nExcelCount = 0 Then

Call MsgBox("Please save any files and quit Microsoft Excel then
press OK", _
vbOKOnly, msgTitle)

Else

Call MsgBox("You still have Excel running. To register this add-in
with Excel " & _
"you need to exit Excel first" & vbCrLf & vbCrLf & _
"If you can't see a running instance of Excel you may have a
hidden instance running" & vbCrLf & vbCrLf & _
"To close a hidden instance, press ALT-CTRL-DEL and remove Excel
from the list of running processes", _
vbOKOnly + vbInformation, msgTitle)

End If

nExcelCount = nExcelCount + 1
Set oXL = Nothing
GoTo TestForExcel

End If

Set oXL = CreateObject("Excel.Application")

'have to add a workbook or you can't add an add-in
oXL.Workbooks.Add

'never been happy with this line since the user could have changed the
default install path
'if you are running your own installer, you could make sure you trap the
right path
strAddInPath = Environ("ProgramFiles") & "\Enhanced
Datasystems\EFALoader.xla"

Set oAddin = oXL.Addins.Add(strAddInPath)
oAddin.installed = True
oXL.Quit
Set oXL = Nothing

Call MsgBox("Install complete", vbInformation + vbOKOnly, "Enhanced
Datasystems")

End Sub

Robin Hammond
www.enhanceddatasystems.com


"McRolin" <(E-Mail Removed)> wrote in message
news:%QP3c.10615$(E-Mail Removed)...
> Hello All,
> I have built an Excel add-in (C++) containing a set of lognormal
> distribution functions. I want to distribute the add-in but currently
> require the user to open Excel and load the add-in using the add-in

manager.
> I would prefer to "add" the add-in to Excel's add-in list during my
> installation. Is there away to automatically load the add-in without

having
> the user manually do it?
>
> Thanks, Roger
>
>



 
Reply With Quote
 
 
 
 
Stephen Bullen
Guest
Posts: n/a
 
      11th Mar 2004
Hi Roger,

> I have built an Excel add-in (C++) containing a set of lognormal
> distribution functions. I want to distribute the add-in but currently
> require the user to open Excel and load the add-in using the add-in manager.
> I would prefer to "add" the add-in to Excel's add-in list during my
> installation. Is there away to automatically load the add-in without having
> the user manually do it?


Sure. Find the registry key:

HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Excel\Options

where 9.0 is Excel 2000, 10.0 is Excel XP etc.

In there, add a new string value, with the next item in the sequence:

OPEN
OPEN1
OPEN2
... etc

i.e. if OPEN doesn't exist, use that. If OPEN, OPEN1 and OPEN2 exist, you
have to use OPEN3. The value of the key is the file name of your xll.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.ie


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Load from database without load whole page tranky Microsoft C# .NET 1 10th Oct 2007 02:58 PM
load=load=load=load= Janusz Sokolowski Windows XP Help 0 26th Oct 2004 02:29 PM
How to lock console without Windows Logo Key and without access to task manager? Vlad Bernstein Windows XP Basics 3 16th Oct 2004 04:14 PM
How to load Business Contact Manager without a server? =?Utf-8?B?Q09CT0NPTVk=?= Microsoft Outlook BCM 2 14th Oct 2004 06:03 PM
Setup Excel to Load Add-in Without Add-in Manager McRolin Microsoft Excel Programming 1 12th Mar 2004 03:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:54 PM.