Link to home
Start Free TrialLog in
Avatar of guxiyou
guxiyou

asked on

How can I remove/disable the Office Button from MS Word 2007?

I am attempting to embed a MS Word 2007 instance inside a C# Application.  I want to make the embedded instance of Word as simple as possible, and I don't want the end users to be able to do anything that will interfere with the intended use of the application.  To accomplish this goal, I want to disable open/save/close file functionality.  Using xml I am able to disable most of the problem functionality, but the Office Button is still causing me problems.  I can remove most of the options, but I have been unable do hide/disable the Office Button, and I have been unable to remove the "Recent Documents" functionality from the menu itself.

I will give points for a solution for how to hide/disable the Office Button, or for how to remove the "Recent Documents" from the Office Button.
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
	<commands> 
		<command idMso="FileNewDatabase" enabled="false"/>
		<command idMso="FileCloseDatabase" enabled="false"/> 
		<command idMso="ApplicationOptionsDialog" enabled="false"/>
		<command idMso="FileOpenDatabase" enabled="false"/>
		<command idMso="FileExit" enabled="false"/>
	</commands>
	<ribbon startFromScratch="true">
		<tabs>
			<tab idMso="TabHome" visible="true" />
			<tab idMso="TabInsert" visible="true" />
			<tab idMso="TabPageLayoutWord" visible="true" />
			<tab idMso="TabReferences" visible="true" />
			<tab idMso="TabMailings" visible="true" />
			<tab idMso="TabReviewWord" visible="true" />
			<tab idMso="TabView" visible="true" />
		</tabs>
		<officeMenu>  
			<control idMso="FileOpen" visible="false" />
			<control idMso="FileNew" visible="false" />
			<control idMso="FileNewDatabase" visible="false"/>
			<control idMso="SourceControlCreateDatabaseFromProject" visible="false"/>
			<control idMso="FileOpenDatabase" visible="false"/>
			<control idMso="FileSave" visible="false"/>
			<control idMso="ConvertDatabaseFormat" visible="false"/>
			<control idMso="FileSaveAsMenuAccess" visible="false"/>
			<control idMso="FileManageMenu" visible="false"/>
			<control idMso="FileSendAsAttachment" visible="false"/>
			<control idMso="MenuPublish" visible="false"/>
			<control idMso="FileServerMenu" visible="false"/>
			<control idMso="FileCloseDatabase" visible="false"/>
			<button idMso="FileCompactAndRepairDatabase" visible="false"/>
			<button idMso="ApplicationOptionsDialog" enabled="false"/>
		</officeMenu>
	</ribbon>
</customUI>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of guxiyou
guxiyou

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of esps
esps

Can you please post an example of how the XML is implimented?

Thanks
For recent files try calling

_WordInstance.DisplayRecentFiles = False

where _WordInstance is of type Word.Application

I'm not sure if it removes all functionality but it takes them off the office button so users can't just click on them.