abhiker
01-16-2009, 12:35 PM
I am installing an addin from within my workbook. The install goes fine. I then have to create a reference to the addin or it does not work. But when i make the reference, the file does not close properly. It ask for the password for the addin. Any help or explanation on this? Below is the code i use for creating the reference and it works fine:
Dim AddiName as String
AddinName = "MyAddIn.xla"
Dim objRef As Object
' for some reason i have to delete the reference first
For Each objRef In ActiveWorkbook.VBProject.References
If objRef.Name = "MyAddIn" Then
Call ActiveWorkbook.VBProject.References.Remove(objRef)
Exit For
End If
Next
g_wbICL.VBProject.References.AddFromFile_ (Excel.Application.LibraryPath & "\" & AddinName)
Dim AddiName as String
AddinName = "MyAddIn.xla"
Dim objRef As Object
' for some reason i have to delete the reference first
For Each objRef In ActiveWorkbook.VBProject.References
If objRef.Name = "MyAddIn" Then
Call ActiveWorkbook.VBProject.References.Remove(objRef)
Exit For
End If
Next
g_wbICL.VBProject.References.AddFromFile_ (Excel.Application.LibraryPath & "\" & AddinName)