tags:

views:

288

answers:

1

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 standard new document dialog. How do I do this? I don't see an application event I can handle and I can't seem to find the buttont to add an event handler too.

A: 

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

Jacob Adams