Search code examples
c#vstooffice-addins

How to call in VSTO build in function after were overwritten?


In my Ribbon.xml is given:

<command idMso="FileSave" onAction="SaveIntercept" getEnabled="IsSaveInterceptEnabled" /> 

in my Ribbon.cs

public void SaveIntercept(IRibbonControl control, ref bool cancelDefault)
{
  if (!IsFileSavedBefore()) <= works :)
  {
    call here build in FileSave 
    (Build in function switch tab when file was never saved before)
    return;
  }
... File was saved before ... continue with my code

}

I already try

RibbonUi.ActivateTabMso("TabSave");

and

Application.CommandBars.ExecuteMso("FileSave");

How call origial functionality?


Solution

  • Maybe this could work?

    public void SaveIntercept(IRibbonControl control, ref bool cancelDefault)
    {
      if (!IsFileSavedBefore())
      {
        cancelDefault = false;
        return;
      }
      ...