I have the following code that should disable the Save As button in Word 2010. The method below is being called in the Document_Startup
event:
private void DisableSaveAsButton()
{
Object MenuBar = 40;
Object FileMenu = 1;
Object SaveAsButton = 5;
var saveAsBtn = this.ThisApplication.CommandBars[MenuBar].Controls[FileMenu].accChild[SaveAsButton] as CommandBarButton;
saveAsBtn.Enabled = false;
}
I am expecting the Save as Button to be grayed out, but it isn't and it still functions. What am I doing wrong?
I figured it out. I just had to add a Ribbon XML item to the project with the following info below. I also needed to disable a few other buttons: