View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Robin Hammond[_2_] Robin Hammond[_2_] is offline
external usenet poster
 
Posts: 575
Default Automation Add-in Distribution problem

Kumar,

This might help with a bit of tweaking. This is how I install an normal
add-in from a vb6 exe file. I haven't tested it with a dll, but I did try it
with an ocx that is already registered and it seemed to work.

Sub InstallAddIn
Dim strAddInPath As String
Dim oAddin As Object
Dim oXL As Object
Dim lReturn As Long
Dim nExcelCount As Integer

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")
'add a book or the add method fails
oXL.Workbooks.Add
strAddInPath= "full path to your file"
Set oAddin = oXL.addins.Add(strAddInPath)
oAddin.installed = True

oXL.Quit
Set oXL = Nothing
End Sub

Robin Hammond
www.enhanceddatasystems.com


"kumar_8675" wrote in message
...

I have made an VB6.0 automation add-in and using it in the excle 2003
spreadsheet to do some calculations.

It seems to be working fine in my machine but when I try to use it in
some other machine, the add-in is not getting added in the excel
automaticaly, even though I register DLL in the new machine.

I have to manually open the excel and add the add-in from the menu item
and check the add-in to work.

I tried to then add in programatically in the onload of the workbook

Set addinXL = Excel.AddIns.Add("MyAddIn.Connect")

but it also does not seem to be working properly the first time.

What is the best way to distribute the add-in and the excel sheet to
others ?
How to install the add-in and the excel spreadshseet and make it work
on a clean machine.

Any help in this regard is appreciated.


--
kumar_8675
------------------------------------------------------------------------
kumar_8675's Profile:
http://www.excelforum.com/member.php...o&userid=15693
View this thread: http://www.excelforum.com/showthread...hreadid=275507