title: Trigger custom ribbon button click in VBA
body: <p>In my project I have a excel ribbon created with the XML like below</p>
  
  <pre><code>&lt;customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" loadImage="LoadRibbonImage" onLoad="onLoad" &gt;&lt;ribbon&gt;&lt;tabs&gt; &lt;tab id="AddInTabId" label="MyCustomRibbon"&gt;
  &lt;group id="Connections" label="Connections"&gt;
  &lt;button id="Config" label="Server Configuration" size="large" getEnabled="getEnabled" onAction="MyActionMethod" screentip="Server Configuration" image="Config.png" /&gt;
  &lt;/group&gt;
  &lt;/tab&gt;&lt;/tabs&gt;&lt;/ribbon&gt;&lt;/customUI&gt;
  </code></pre>
  
  <p>It works great when I manually click on the ribbon button. My ribbon button click event is handled in C# method so on click of button my C# method gets invoked.</p>
  
  <p>Now I need to trigger this Config button click through a VBA code in excel. Please suggest how should I do it. I tried using commandbars as below but it does not work.</p>
  
  <pre><code>Dim b As CommandBarButton
  Set b = Application.CommandBars("AddInTabId").Controls("Config")
  If (b.Enabled = True) Then
  b.Execute
  End If
  </code></pre>