PDA

View Full Version : Solved: Help for Turning Off Alerts for Missing Addin



abhiker
01-07-2009, 06:59 AM
I am trying to turn off the application alerts that appear when i open a file that needs an addin. I have tried the following code in the Workbook_Open subroutine but i still get the Microsoft Excel Alert Box. Any suggestions as i do not want the alert box to pop up. Thanks in advance.




On Error Resume Next

Application.DisplayAlerts = False
Application.AddIns("IclAddIn").Installed = True
Application.DisplayAlerts = True

On Error GoTo 0

lucas
01-07-2009, 08:17 AM
What in the file is making it look for the addin. Wouldn't it be better to address that?

abhiker
01-07-2009, 10:39 AM
when the workbook opens, i run the code to install the addin. But if the addin is not available, i don't want the warning message.

lucas
01-07-2009, 10:43 AM
Then check to see if it exists before you run the code to install it.

lucas
01-07-2009, 11:15 AM
Change LucasTools part to the name of the .xla file you are checking for....
Option Explicit
Sub a()
Dim AddinName As String
AddinName = "LucasTools" & ".xla"
If Dir(Application.UserLibraryPath & AddinName) = Empty Then
MsgBox "does not exist"
ElseIf Dir(Application.UserLibraryPath & AddinName) <> Empty Then MsgBox "exists"
End If
End Sub

abhiker
01-07-2009, 12:34 PM
Thank you. I took the advice and it works. But I was wondering if the following code does the exact same thing or not? Do both check if addin file exists? How do you check to see if the addin is actually loaded in excel or not? Or is loaded and exist the same thing? Thank you.


Dim b As Boolean
b = CheckAddin("IclAddIn")
MsgBox "IclAddIn is " & IIf(b, "", "not ") & "installed"

Function CheckAddin(s As String) As Boolean
Dim x As Variant
On Error Resume Next
x = AddIns(s).Installed
On Error GoTo 0
If IsEmpty(x) Then
CheckAddin = False
Else
CheckAddin = True
End If
End Function

lucas
01-07-2009, 03:20 PM
Here's you a little light reading since you are working on addins you should try to learn a little about them first. There are 11 pages but most are short:

http://vbaexpress.com/forum/showthread.php?t=10855

abhiker
01-07-2009, 04:10 PM
Thank you for the help and documentation. I am on the right path now.

lucas
01-07-2009, 05:44 PM
If you run into problems post them here or start a new thread.