

Set oPopUp = CommandBars("Text").Controls("My Very Own Menu")

'Make command bar changes in Add-In template The "On Action" procedures are the procedures that you provide and set to run when the user clicks on the control. Both of the custom controls (i.e., controls that aren't assigned a built-in Id) references an "On Action" procedure. Two built-in Word button commands and two custom buttons controls. In the example, I added four button controls.
CLASSIC MENU FOR WORD 2016 HOW TO
See: Installing Macros for instructions on how to set up and use the macros provided in this Microsoft Word Help & Microsoft Word Tips page. & vbCr + vbCr & "Recommend you save those changes now.", vbInformation + vbOKCancel, _ If MsgBox("This action caused a change to your Add-In template." _ Set oBtn = Application.CommandBars("Text").Controls.Add(msoControlButton, 758,, 2)

'Add control using built-in ID 758 (Boo&kmarks.) Set oBtn = CommandBars.FindControl(Tag:="custCmdBtn") 'Or add individual commands directly to menu OnAction = "MySCMacros.MyInsertAutoText" 'Add a Builtin command using ID 1589 (Co&mments) 'Identify the module and procedure to run Set oPopUp = CommandBars("Text").Controls.Add(msoControlPopup,, , 1) 'Add PopUp menu control to the top of the "Text" short-cut menu If Not oPopup Is Nothing Then GoTo Add_Individual Set oPopup = CommandBars.FindControl(Tag:="custPopup") The illustration below shows the PopUp menu and new commandbar controls added at the top of the "Text" shortcut menu.ĬustomizationContext = ThisDocument.AttachedTemplate
CLASSIC MENU FOR WORD 2016 CODE
You can download this file which contains all of the code used to create the examples using the link at the end of this tips page. To develop and describe these procedures, I have created a global template add-in file named Customize Shortcut Menu.dotm. However, as the shortcut menus are contextual, there are situations when it will be replaced by another menu and not be displayed. Note: The "Text" shortcut menu is probably the most prevalent when users right click their mouse.

While I can't cover every customization possibility, I am going to present few examples which will demonstrate: However, most users never had a need for it since these menus and toolbars were easily customized through the user interface. The ability to customize the Word menus and toolbars programmatically is available in earlier versions of Word. Many of the methods presented here aren't new. They form the invisible framework for the ribbon interface and they remain visible in the form of the shortcut menus that you see when you right click text.įor a fast as simple method using RibbonXML see: Customize a ContextMenu w/RibbonXML and my tips on ribbon customization at Customize the Ribbon (It doesn't take Rocket Science). Command Barsīelieve it or not, Command Bars and their popup menus and controls have not been completely relegated to history. While alleviating the problem somewhat with the introduction of limited customization capability in Word 2010, this Microsoft Word Help & Tips page can still be beneficial and will show you how to use VBA to customize the Word shortcut (aka right-click) menus both programmatically using VBA or with RibbonXML. Making matters worse they practically eliminated the ability to change and customize the interface without resorting to third party add-ins or doing your own programming. As many Word users (perhaps only the old timers now) are painfully aware, the masters at Microsoft radically changed the user interface in Word 2007 with the introduction of the ribbon.
