Consulting

Results 1 to 9 of 9

Thread: Solved: Help for Turning Off Alerts for Missing Addin

  1. #1
    VBAX Regular
    Joined
    Feb 2008
    Location
    atlanta
    Posts
    20
    Location

    Solved: Help for Turning Off Alerts for Missing Addin

    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.


    [vba]

    On Error Resume Next

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

    On Error GoTo 0

    [/vba]

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    What in the file is making it look for the addin. Wouldn't it be better to address that?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Regular
    Joined
    Feb 2008
    Location
    atlanta
    Posts
    20
    Location
    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.

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Then check to see if it exists before you run the code to install it.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Change LucasTools part to the name of the .xla file you are checking for....
    [vba]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[/vba]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  6. #6
    VBAX Regular
    Joined
    Feb 2008
    Location
    atlanta
    Posts
    20
    Location
    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.

    [VBA]
    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

    [/VBA]

  7. #7
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    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
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  8. #8
    VBAX Regular
    Joined
    Feb 2008
    Location
    atlanta
    Posts
    20
    Location
    Thank you for the help and documentation. I am on the right path now.

  9. #9
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    If you run into problems post them here or start a new thread.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •