title: How can an Excel Add-In respond to events in any worksheet?
body: <p>Our workbooks are <strong>server-generated SpreadsheetML</strong>, which cannot include <em>any</em> VBA code. Creating native Excel files or Excel 2007 XML files is also not an option, unfortunately.</p>
  
  <p>So, I have an Excel Add-In (VBA, not XLL) that each of our users installs to add some extra UDFs, etc. that our workbooks need.</p>
  
  <p>This works great, but now I need to have a macro that needs to execute <em>every time</em> the user changes the text in any cell, regardless what workbook they are actively using at the time.</p>
  
  <p>So far, I've created a new Class module (SheetChangeHandler) in my Add-In, with the following code:</p>
  
  <pre><code>Option Explicit
  Private WithEvents App As Application
  
  Private Sub Class_Initialize()
      Set App = Application
  End Sub
  
  Private Sub App_SheetChange(ByVal Sh As Object, ByVal Source As Range)
      Debug.Print "Changed"
      On Error GoTo Finish
      App.EnableEvents = False
      DoWorkOnChangedStuff Sh, Source
  Finish:
      App.EnableEvents = True
  End Sub
  </code></pre>
  
  <p>In my Add-In, I've added a line to instantiate the new class:</p>
  
  <pre><code>Public MySheetHandler As New SheetChangeHandler
  </code></pre>
  
  <p>My understanding is that this should make Excel send the Add-In <em>all</em> SheetChange events for all open workbooks, without those workbooks needing to contain any macro code.</p>
  
  <p>But it's not working... no Debug lines, and my DoWorkOnChangedStuff code isn't being called when I change a cell on any worksheet.</p>
  
  <p>Any ideas?</p>