+ Reply to Thread
Results 1 to 3 of 3

Private Sub in Add-In

  1. #1
    Registered User
    Join Date
    01-28-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    5

    Private Sub in Add-In

    I am attempting to create an Add-In in Excel. I want (on only one sheet) for this Add-In to run a private sub that runs a macro when the user double clicks on a certain range of cells.

    I have this macro working fine in the file that I create the Add-In from. How do I get it to work in a different file once the Add-In has been installed?

    I have installed the Add-In and gone to Tools>References in VBA, so that is not the issue. Any ideas on why the code won't run on double click??

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Private Sub in Add-In

    Hi, Vaw08,

    simple answer: because an AddIn isnīt showing any worksheets to the user. To work around that you should have a look at Class programming where you Would catch the event in other worbooks and can work with that from the addin.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    01-28-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Private Sub in Add-In

    Thanks for your reply. This makes a lot of sense, and I now have my private sub working when the active workbook catches the double click event. Then it runs the macro from the add-in. I just have one issue. My macro unprotects the sheet, does something and reprotects. When testing the macro before making it into an add-in, it worked fine. Now, when I run the macro from within a different workbook as an add-in, it is making the changes I want, but then popping up and saying that the sheet is protected. Any ideas?

    I tried Application.DisplayAlerts = False, but I got an error when I tried that.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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