Handle File->New in Word 2007

后端 未结 1 1191
予麋鹿
予麋鹿 2020-12-18 14:44

I am writing a VSTO addin for Word 2007. When the user selects File->New, (or selects it from the quick access toolbar) I need to display a custom form instead of the standa

相关标签:
1条回答
  • 2020-12-18 15:18

    Ok, just found it. You need to create a Ribbon xml and then add commands for those buttons. In this case the ribbon xml 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 how-to on MSDN shows you how to do it http://msdn.microsoft.com/en-us/office/dd361753.aspx

    0 讨论(0)
提交回复
热议问题