Possible?

Oorang

Well-known Member
Joined
Mar 4, 2005
Messages
2,071
I am very comfortable with VBA and am willing to branch out to other languages if needed to accomplish this. Is it possible to have excel run an add-in but not have it show up in the add-in dialog box in the tools menu?
(If have users who will turn then off because they don't know what it is.)
Alternatly does anyone have any ideas about just preventing people from disabling my add in?
 

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
7,417
Office Version
2016
Platform
Windows
How about disabling the Add-In menu or password-protecting it so noone can uninstall your custom AddIn unless of course you want your users to acccess the AddIn Dialogue Box with no restrictions?

Regards.
 

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
7,417
Office Version
2016
Platform
Windows
Password-Protecting the Add-In dialogue box will still prevent users from accessing the all the Add-Ins which is not what you want.

The only solution I can think of is probably rebuilding the whole Add-Ins Dialogue Box using a custom UserForm which will mimic the built-in Add-Ins dialogue Box but will omit your particular Add-in.

Of course this involves some more coding so I am not sure it would be worth it.

Regards.
 

Oorang

Well-known Member
Joined
Mar 4, 2005
Messages
2,071
I can do that... ROFL... hmmm that could actually work. It sounds like the Sony-Way but it would work.

An alternate idea... anyone know of how to just prevent it from appearing in the list?
 

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
7,417
Office Version
2016
Platform
Windows
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.
 

Forum statistics

Threads
1,078,100
Messages
5,338,242
Members
399,216
Latest member
Macho99

Some videos you may like

This Week's Hot Topics

Top