Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Mar 2010
    Location
    Texas
    Posts
    54
    Thanks
    9
    Thanked 0 Times in 0 Posts
    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?

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    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.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Star Lounger
    Join Date
    Mar 2010
    Location
    Texas
    Posts
    54
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Excellent. Thanks!

  4. #4
    Star Lounger
    Join Date
    Mar 2010
    Location
    Texas
    Posts
    54
    Thanks
    9
    Thanked 0 Times in 0 Posts
    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?

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    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.
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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