• Adding and Severing References on open and close ((Excel 2k sr1))

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Adding and Severing References on open and close ((Excel 2k sr1))

    Author
    Topic
    #370889

    Hello,

    I am currently developing an Add-In that is designed to work only when a specific workbook is opened. I have been able to succesfuly create the reference to the add-in at design time. However, when I close the workbook that uses the procedures in the add-in, the toolbar and menu remain behind.

    How can I hide any trace of the add-in so that the users will not try to use it with other workbooks?

    Basicaly, I want the add-in to appear when the target workbook is opened and disappear when the target is closed or deselected.

    Thanks,

    Viewing 0 reply threads
    Author
    Replies
    • #588094

      You could use the workbook close event to set the installed proprty to false. Place the following code in the ThisWorkbook object of the Workbook that uses the AddIn:

      Private Sub Workbook_BeforeClose(Cancel As Boolean)
          AddIns("AddinName").Installed = False
      End Sub

      replacing “AddinName” with the actual name of your Addin.

      Just as a matter of interest, if the AddIn is for the use of a single workbook, why not build the functionality into the workbook itself ?.

      Andrew C

    Viewing 0 reply threads
    Reply To: Adding and Severing References on open and close ((Excel 2k sr1))

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: