• Sharing VBA Events Code With Others

    Author
    Topic
    #473451

    I have some code that I would like to share with users on our network. The code detects a double click event. It resides in ThisWorkbook module of an Excel workbook.

    I can share code and functions other ways but how can I share this events code without having to update everyone’s workbooks indivdually?

    Viewing 3 reply threads
    Author
    Replies
    • #1257804

      That code is specific to that workbook and cannot be shared. You need to create an add-in with an Application variable declared WithEvents so that you can respond to the Application_SheetBeforeDoubleClick event. See Chip Pearson’s site here for example.

    • #1257856

      Excellent. Thanks!

    • #1258732

      Taking this one step further, Word has the convient template file that allows you to update code for all the template users just by switching out the template or making changes to it. Is there a similar feature in Excel?

      The problem with having code in one file is that all users sharing that code have to be updated individually. Can an addin be used but tied into the WithEvents?

    • #1258744

      Excel works completely differently from Word as far as templates go, so there is no equivalent.
      If you use the WithEvents code in an add-in that you store centrally, you can update all users simply by updating the central add-in. For details of how to do that, see Ken Puls site here.

    Viewing 3 reply threads
    Reply To: Sharing VBA Events Code With Others

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

    Your information: