tags:

views:

55

answers:

0

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/2006/01/customui"&gt;
    <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:

Sub MySave(control As IRibbonControl, ByRef cancelDefault)
     someFancyPreparationFunction
     oldSaveFunction 
     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 are very appreciated!