Repurpose builtin Word commands - access original command within repurposed function
- by Aurril
It is possible to repurpose a Word builtin command in Word 2007 using the customUI.xml file.
Example:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<commands>
<command idMso="Save" onAction="MySave"/>
</commands>
</customUI>
I then have to define a callback function in VBA which is used instead of the builtin function:
'Callback for Save onAction
Sub MySave(control As IRibbonControl, ByRef cancelDefault)
someFancyPreparationFunction
oldSaveFunction ' Where, how?
someOtherFancyAfterWorkFunction
End Sub
And here is my problem, if I want to reuse internal functionality in my repurposed Function, I don't know how to access it. My example is trivial and the save could be easily rebuilt by a call to ThisDocument.save but as I said, it is just an example to show the problem.
A call to CommandBars.ExecuteMso('Save') would call my repurposed function and not the original one. Any ideas on how to access the internal functionality after repurposing would be very appreciated!