+ Reply to Thread
Results 1 to 3 of 3

Installing .XLA on file open

  1. #1
    Registered User
    Join Date
    05-01-2004
    Posts
    8

    Installing .XLA on file open

    Using John Walkenbachs book I used the following code;

    Dim InstalledProperly As Boolean
    Private Sub Workbook_AddinInstall()
    InstalledProperly = True
    End Sub
    Private Sub Workbook_Open()
    If Not ThisWorkbook.IsAddin Then Exit Sub
    If Not InstalledProperly Then
    ' Add it to the AddIns collection
    If Not InAddInCollection(ThisWorkbook) Then _
    AddIns.Add Filename:=ThisWorkbook.FullName
    ' Install it
    AddInTitle = GetTitle(ThisWorkbook)
    Application.EnableEvents = False
    AddIns(AddInTitle).Installed = True
    Application.EnableEvents = True
    ' Inform user
    Msg = ThisWorkbook.Name & _
    "has been installed as an add-in."
    Msg = Msg & _
    "Use the Tools Add-Ins command to uninstall it."
    MsgBox Msg, vbInformation, AddInTitle
    Call CreateMenu
    End If
    End Sub

    When it runs I get "Compile Error:
    Sub or Function not defined and it highlights the "InAddInCollection I have bolded above. I want this to install properly no matter if the user double clicks or file opens the file.

    Any thoughts?

  2. #2

    Re: Installing .XLA on file open

    Thats because you have to define InAddInCollection().
    Try this:

    Function InAddInCollection(wb) As Boolean
    For Each Item In AddIns
    If Item.Name = wb.Name Then
    InAddInCollection = True
    End If
    Next Item
    End Function

    good luck.

    /m

    http://www.aminaahmed.com


  3. #3
    Registered User
    Join Date
    05-01-2004
    Posts
    8
    Thanks, that worked with a little manapulation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1