Whilst writing an add-in for office, I've had to define an eventhandler for the
From what I assume based on your question you would like to run some piece of code only in the case that a document actually is saved.
A common solution to this is to intercept the actual Save command instead of registering an event handler for the
DocumentBeforeSave event (which, as you describe, is also fired if the actual save operation never takes place).
How this is done is described in my answer here. Note that you would have to define the custom save command in your Ribbon XML, and then place the code that should run during save in the corresponding Ribbon callback function.