Edraw Office Viewer Components can disable the office main button and protect the opened document was modified by the end users. Only call the DisableFileCommand method in the BeforeDocumentOpen event and set the different enumerates.
boolean DisableFileCommand([in] WdUIType UIType, [in]
boolean Disable);
UIType: The enum type need to disable in the UI. WdUIType.
Disable: True to disable the command button or menu item.
enum WdUIType
{
wdUIDisalbeOfficeButton = 0x00000001,
wdUIDisalbeNew = 0x00000002,
wdUIDisalbeOpen = 0x00000004,
wdUIDisalbeUpgradeDocument = 0x00000008,
wdUIDisalbeSave = 0x00000010,
wdUIDisalbeSaveAs = 0x00000020,
wdUIDisalbeSendAsAttachment = 0x00000040,
wdUIDisalbeClose = 0x00000100,
wdUIDisalbePrint = 0x00000200,
wdUIDisalbePrintQuick = 0x00000400,
wdUIDisalbePrintPreview = 0x00000800,
wdUIDisalbeSaveAsMenu = 0x00001000,
wdUIDisalbePrepareMenu = 0x00002000,
wdUIDisalbePermissionRestrictMenu = 0x00004000,
wdUIDisalbeSendMenu = 0x00008000,
wdUIDisalbePublishMenu = 0x00010000,
wdUIDisalbeServerTasksMenu = 0x00020000,
wdUIDisalbeCopyButton = 0x00040000,
wdUIDisalbeCutButton = 0x00080000,
wdUIHideMenuHome = 0x01000000,
wdUIHideMenuInsert = 0x02000000,
wdUIHideMenuPageLayout = 0x04000000,
wdUIHideMenuReferences = 0x08000000,
wdUIHideMenuMailings = 0x10000000,
wdUIHideMenuReview = 0x20000000,
wdUIHideMenuView = 0x40000000,
wdUIHideMenuDeveloper = 0x80000000,
wdUIHideMenuAddIns = 0x00100000,
wdUIHideMenuFormat = 0x00200000,
wdUIHideMenuEdit = 0x00400000,
wdUIHideMenuTool = 0x00800000,
}WdUIType;
Note: The component disabled the Office menu, New button and Open
button in default.
DWORD dwDisableCommand = wdUIDisalbeOfficeButton |
wdUIDisalbeNew| wdUIDisalbeOpen;
The function need be set in the BeforeDocumentOpened event.
If you want to enable the three button, follow the samples.
Example
The following vb script shows how to enable the office main menu, new button and open
button.
Sub DocumentOpenedEvent ()
Edword.DisableFileCommand 1 , false ‘wdUIDisalbeOfficeButton
Edword.DisableFileCommand 2 , false ‘wdUIDisalbeNew
Edword.DisableFileCommand 4 , false ‘wdUIDisalbeOpen
End Sub
SCRIPT FOR=OA1 EVENT= DocumentOpened ()
DocumentOpenedEvent()
SCRIPT
The following vb script shows how to diable the saveas and save button.
Sub DocumentOpenedEvent ()
Edword.DisableFileCommand 16 , true ‘wdUIDisalbeSave
Edword.DisableFileCommand 32 , true ‘wdUIDisalbeSaveAs
End Sub
SCRIPT FOR=OA1 EVENT= DocumentOpened ()
DocumentOpenedEvent()
SCRIPT
2 Responses to “Disable the Office Menu”
Leave a Reply
You must be logged in to post a comment.
June 28th, 2010 at 11:04 am
for the office 2003, you can use the follow method to show or hide the commandbar.
boolean UpdateOffice2003ToolbarButton([in] long OfficeID,
[in] boolean Visible, [in] boolean Enabled);
Disables or hides the office 2000, 2003 toolbar button.
OfficeID: The office MSO id for every button.
Visible: True to set the command button visible.
Enabled: True to enable the command button.
The function works only in the Office 2000/2003 version.
The following vb script shows how to hide the saveas and save button.
Sub DocumentOpenedEvent ()
Edword.UpdateOffice2003ToolbarButton 3 , false, false ‘save button
Edword.UpdateOffice2003ToolbarButton 748 , false, false ‘saveas button
End Sub
</SCRIPT FOR=OA1 EVENT= DocumentOpened ()>
DocumentOpenedEvent()
</SCRIPT>
June 28th, 2010 at 11:05 am
Show or hide the office 2003 toolbar
boolean InvisibleOffice2003Toolbar([in] BSTR ToolbarName);
Disables or hides the office 2000, 2003 toolbar.
ToolbarName: The office 2000, 2003 commandbar name.
The following vb script shows how to hide the standard toolbar, web toolbar and formatting
toolbar.
Sub DocumentOpenedEvent ()
Edword.InvisibleOffice2003Toolbar “Standard”
Edword.InvisibleOffice2003Toolbar “Web”
Edword.InvisibleOffice2003Toolbar “Formatting”
End Sub
</SCRIPT FOR=OA1 EVENT= DocumentOpened ()>
DocumentOpenedEvent()
</SCRIPT>