Home > Software engineering >  How to hide an excuse me each expert, vb menu "review"?
How to hide an excuse me each expert, vb menu "review"?

Time:09-23

How to hide an excuse me each expert, vb menu "review"?

CodePudding user response:

Fyi:

Add and manage the menu bar and the menu items
Please refer to the characteristics of
Some container application does not provide the method of a new menu bar, therefore, need to use Visual Basic to create a menu bar, using Visual Basic to create a menu bar, application program interface is available container or continue to use Visual Basic define the menu bar,

At run time to add menu bar
At run time to Add a menu bar, application available CommandBars set the Add method and the MenuBar parameter specifies the is True, do not remove the following example will Add a menu bar, and the fixed in the menu bar on the right side of the application window,

The Set menubar=CommandBars. Add _
: (Name="mBar, Position:=msoBarRight, MenuBar:=True)
With menubar
The Protection=msoBarNoMove
The Visible=True
End With
Run time modify menu bar
At run time can modify the menu bar and its control at the same time, the menu bar changes may affect the appearance or position; Change depends on the type of the control of the control at run time changes are listed in the table below the menu bar of the most common properties and methods,

Attribute or method statement
Add with CommandBars set the Add method to Add a menu bar and specify the MenuBar parameter is True,
Enabled if this property is set to True, then the user can use Visual Basic code displayed on the specified menu bar; If this attribute is set to False, the user can not display the menu bar, but the menu bar will be listed in the menu bar effectively list,
Protection, prohibited the user to a specific operation of the menu bar, but the value is set to be one of the following MsoBarProtection constants or combination: msoBarNoChangeDock, msoBarNoChangeVisible, msoBarNoCustomize, msoBarNoHorizontalDock, msoBarNoMove, msoBarNoProtection, msoBarNoResize and msoBarNoVerticalDock,
New menu bar Position specified relative to the location of the application window, it can be set to one of the following MsoBarPosition constants: msoBarLeft, msoBarTop, msoBarRight, msoBarBottom, msoBarFloating, msoBarPopup (used to create shortcut menu) or msoBarMenuBar (Macintosh),
Visible specified is a show or hide the control to the user, if the control is hidden to the user, the name of the menu bar will display in the valid command bar list,


The following example can be implemented: hidden activity menu bar and a temporary menu bar instead of the temporary fixed menu bar at the right hand the application window, and to the user in the protection state,

The Set oldMbar=CommandBars. ActiveMenuBar
The Set newMbar=CommandBars. Add _
: (Name="newMenubar", Position:=msoBarRight, _
MenuBar:=True, temporary:=True)
With newMbar
The Visible=True
The Protection=msoBarNoMove
End With
At run time to merge menu bar
Custom menu bar to load the application, if you want to specify representation of its application in container, the available CommandBarPopup object OLEMenuGroup attribute of the specified menu bar merger way,

To modify a menu item for running time
Scope changes depend on the type of control of a menu item, usually, button has two kinds of effective and hidden, and edit boxes, drop-down list box and combo box can be carried out more diversified operation: can add or delete a list item in the list, can also be determined according to the value of the selected to perform an action, the user can add any control action to the built-in function or a custom function,

The following table is a change control state, action or the content of the most common properties and methods,

Property or method purpose
Add in the command bar to Add a menu item, the built-in control, Type variables can be one of the following MsoControlType constants: msoControlButton, msoControlEdit, msoControlDropdown or msoControlComboBox,
AddItem in the drop-down list box or combo box type dropdown list area to add a list item, for the existing new item in the list of designated an index number, but its value is not greater than the number on the list, otherwise the AddItem method fails,
Style specifies the icon to display the button appearance is still shows its title, this value can be one of the following MsoButtonStyle constants: msoButtonAutomatic, msoButtonIcon, msoButtonCaption, msoButtonIconAndCaption, msoButtonIconAndCaptionBelow, msoButtonIconAndWrapCaption, msoButtonIconAndWrapCaptionBelow or msoButtonWrapCaption,
OnAction specified when a user changes the value of the specific control to run the process,
Visible to specify the control on the user is shown or hidden,


The following example at the end of the activity menu bar to add a named "Custom" temporary pop-up control, then on the Custom pop-up command bar, a button control "Import" is added to the

The Set myMenuBar=CommandBars. ActiveMenuBar
The Set newMenu=myMenuBar. Controls. The Add (Type:=msoControlPopup, _
Temporary:=True)
NewMenu. Caption="Custom"
The Set ctrl1=newMenu. Controls _
. The Add (Type:=msoControlButton, Id:=1)
Ctrl1. Caption="Import"
Ctrl1. TooltipText="Import"
Ctrl1. Style=msoButtonCaption

CodePudding user response:

Thank you, but it may not be able to solve my problem, I need is a vb excel2007 operation and banned the "review" feature,
  • Related