Process File-> New in Word 2007

I am writing a VSTO add-in for Word 2007. When the user selects File-> New (or selects it from the Quick Access Toolbar), I need to display the UserForm instead of the standard New Document dialog box. How should I do it? I don't see an application that I can handle and I cannot find a button to add an event handler.

+2


source to share


1 answer


Ok, just found it. You need to create xml Ribbon and then add commands for these buttons. In this case, the xml feed is

<commands>
    <command idMso="FileNew" onAction="FileNewOverride"/>
    <command idMso="FileNewDefault" onAction="FileNewOverride"/>
</commands>

      

and the code behind is



public void FileNewOverride(Office.IRibbonControl control, ref bool cancelDefault)
    {
        //do something
    }

      

This practical MSDN tutorial shows you how to do it http://msdn.microsoft.com/en-us/office/dd361753.aspx

+2


source







All Articles