title: C# Word add-in - ribbon
body: <p>I'm trying to create a simple Word add-in. I have created a Word 2010 add-in project with this auto-generated code:</p>
  
  <pre><code>public partial class ThisAddIn
      {
          private void ThisAddIn_Startup(object sender, System.EventArgs e)
          {
          }
  
          private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
          {
          }
  
  protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject() {
              OwnRibbon ribbon = new OwnRibbon();
              //ribbon.DocumentProperty = //get the document here
              return ribbon;
          }
          #region VSTO generated code
  
          /// &lt;summary&gt;
          /// Required method for Designer support - do not modify
          /// the contents of this method with the code editor.
          /// &lt;/summary&gt;
          private void InternalStartup()
          {
              this.Startup += new System.EventHandler(ThisAddIn_Startup);
              this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
          }
  
          #endregion
      }
  </code></pre>
  
  <p>I've looked at the documentation and I understand how I can add text to the document from this class. What I have however, is a Ribbon (created via new item -> ribbon (visual designer)) with two buttons.</p>
  
  <p>When a button is pressed, I would like to add text to the document. However, this ribbon creates a seperate class:</p>
  
  <pre><code>public partial class OwnRibbon
      {
          private void OwnRibbon_Load(object sender, RibbonUIEventArgs e)
          {
  
          }
  
          private void btnInvoegen_Click(object sender, RibbonControlEventArgs e)
          {
          }
      }
  </code></pre>
  
  <p>How can I access the document from the click event handler?</p>
  
  <p>Thanks</p>