anyone know of how to just prevent it from appearing in the list?
Oorang,
I don't think that is possible unless you rebuild a similar Add-ins list via a UserForm as I mentioned earlier...
Here is another approach ( or rather a trick) , not very elegant, But it does prevent users from disabling your AddIn.This approach makes use of the handy
AddinUninstall event of the Addin.
However, for this approach to work, you will have to create a
Personal.xls workbook ( Unless you have one already) and add a small routine to one of its
Standard Modules as follows :
Code:
Public Sub ReinstallAddin()
Dim strAddInName2 As String
strAddInName2 = Evaluate(Application.Names("AddinName").RefersTo)
Names("AddinName").Delete
AddIns(strAddInName2).Installed = True
End Sub
Note that to create a Personal.xls , you need to save a Workbook in the
XLSTART folder under the name of Personal.xls.
In my machine, this folder is located in :
C:\Program Files\Microsoft Office\Office10\xlstart ( WXP XL 2002 )
Now, you need to add the following code to your AddIn in the
ThisWorkBook Module:
Code:
Private Sub Workbook_AddinUninstall()
Dim strAddInName1, strPass As String
strAddInName1 = Left(Me.Name, Len(Me.Name) - 4)
Application.Names.Add "AddinName", strAddInName1
strPass = InputBox("Enter password to Un-Install the AddIn :", strAddInName1)
If StrPtr(strPass) = 0 Then 'if Cancelled reinstall
GoTo ReInstall
ElseIf UCase(strPass) <> UCase("YourPassWord") Then 'else msgbx + ReInstall
MsgBox "Wrong Password !" & vbCr & vbCr & _
"Un-installation unsuccessful !", vbCritical, "Un-Installing " & strAddInName1
Else
Exit Sub ' else do nothing
End If
ReInstall:
Application.OnTime Now + TimeSerial(0, 0, 1), "Personal.xls!ReinstallAddin"
End Sub
Notice the password I have used in the code is "
YourPassWord". Change this as required.
Finally, you need to save the changes you made to the two files ( Addin and Personal.xls) .
Now, if the user tries un-installing your AddIn, they will be prompted for a password.If the password is not valid, the AddIn will re-install itself immediatly.
Regards.