Microsoft word right click menu

The indevelopment, illustrations and also code had in my "Microsoft Word Tips" are gave cost-free and also without hazard or obligation.

You watching: Microsoft word right click menu

However before, the job-related is mine. If you use it for commercial functions or benefit from my initiatives via income earned or time conserved then a donation, however tiny, will certainly help to ensure the continued availability of this resource.

If you would prefer to donate, please use the correct donate switch to accessibility PayPal. Thank you!


As many Word customers (perhaps just the old timers now) are paincompletely aware, the masters at Microsoft radically readjusted the user interface in Word 2007 via the advent of the ribbon. Making matters worse they practically got rid of the ability to readjust and customize the interchallenge without resorting to third party add-ins or doing your own programming.

While alleviating the problem somewhat through the development of restricted customization capability in Word 2010, this Microsoft Word Assistance & Tips web page have the right to still be beneficial and also will certainly show you how to use VBA to customize the Word shortcut (aka right-click) menus both programmatically utilizing VBA or with RibbonXML.

Command Bars

Believe it or not, Command also Bars and also their popup menus and controls have actually not been completely relegated tobackground. They create the invisible framework for the ribbon interconfront and they reprimary visible in the develop of the shortreduced menus that you watch when you best click message.

For a rapid as basic strategy using RibbonXML see: Customize a ContextMenu w/RibbonXML and my tips on ribbon customization at Customize the Ribbon (It doesn"t take Rocket Science).


*

Many of the techniques presented below aren"t brand-new. The capacity to customize the Word menus and toolbars programmatically is easily accessible in earlier versions of Word. However before, a lot of individuals never before had a require for it since these menus and also toolbars were conveniently customized via the user interconfront.

While I can"t cover every customization possibility, I am going to present few examples which will certainly demonstrate:

Adding a brand-new PopUp menu manage to the "Text" shortreduced food selection. Adding 3 Button controls to the brand-new PopUp food selection. Adding a single independent Button control to the "Text" shortreduced food selection. Adding a practice picture to a button face using an exterior graphic file. Adding a practice photo to a switch face making use of a resource file installed in the document"s OpenXMLStyle file package.

For a recent helpful example, check out Word 2013-2016 AutoCorrect Restored

Note: The "Text" shortcut food selection is probably the the majority of common as soon as individuals ideal click their computer mouse. However, as the shortcut menus are contextual, tright here are situations once it will be reput by another food selection and not be shown.

To develop and explain these steps, I have developed an international design template add-in file named Customize Shortcut Menu.dotm. You can download this file which has every one of the code supplied to produce the examples utilizing the connect at the finish of this tips page.

The illustration listed below mirrors the PopUp food selection and also new commandbar controls added at the optimal of the "Text" shortreduced food selection.


*

Customization Code

Word"s built-in CommandBar "Text" can be customized utilizing VBA steps as shown below:


VBA Script:
Copy to clipboard

Option ExplicitDim oPopUp As CommandBarPopupDim oCtr As CommandBarControlSub BuildControls()Dim oBtn As CommandBarButton "Make changes to the Add-In template CustomizationContext = ThisDocument.AttachedTemplate "Prevent double customization Set oPopup = CommandBars.FindControl(Tag:="custPopup") If Not oPopup Is Nothing Then GoTo Add_Individual "Add PopUp menu control to the peak of the "Text" short-reduced food selection Set oPopUp = CommandBars("Text").Controls.Add(msoControlPopup, , , 1) With oPopUp .Caption = "My Very Own Menu" .Tag = "custPopup" .BeginGroup = True End With "Add controls to the PopUp food selection Set oBtn = oPopUp.Controls.Add(msoControlButton) With oBtn .Caption = "My Number 1 Macro" .FaceId = 71 .Format = msoButtonIconAndCaption "Identify the module and procedure to run .OnAction = "MySCMacros.RunMyFavMacro" End With Set oBtn = Nothing "Add a Builtin command making use of ID 1589 (Co&mments) Set oBtn = oPopUp.Controls.Add(msoControlButton, 1589) Set oBtn = Nopoint "Add the third switch Set oBtn = oPopUp.Controls.Add(msoControlButton) With oBtn .Caption = "AutoText Complete" .FaceId = 940 .Style = msoButtonIconAndCaption .OnAction = "MySCMacros.MyInsertAutoText" End With Set oBtn = NothingAdd_Individual: "Or add individual commands directly to food selection Set oBtn = CommandBars.FindControl(Tag:="custCmdBtn") If Not oBtn Is Nopoint Then Exit Below "Add manage utilizing built-in ID 758 (Boo&kmarks...) Set oBtn = Application.CommandBars("Text").Controls.Add(msoControlButton, 758, , 2) oBtn.Tag = "custCmdBtn" If MsgBox("This activity resulted in a change to your Add-In template." _ & vbCr + vbCr & "Recommend you save those changes now.", vbInformation + vbOKCancel, _ "Save Changes") = vbOK Then ThisDocument.Save End If Set oPopUp = Nothing Set oBtn = Nothinglbl_Exit: Exit SubEnd Below
See: Installing Macros for instructions on exactly how to erected and use the macros offered in this Microsoft Word Assistance & Microsoft Word Tips web page.

In the instance, I added four button controls. Two integrated Word switch commands and also two tradition butloads controls. Both of the tradition controls (i.e., controls that aren"t assigned a built-in Id) recommendations an "On Action" procedure. The "On Action" steps are the procedures that you administer and also collection to run once the user clicks on the manage.

The 2 I supplied in are shown below:


VBA Script:
Copy to clipboard

Sub RemoveContentMenuItem() "Make command also bar transforms in Add-In layout CustomizationConmessage = ThisDocument.AttachedTemplate On Error GoTo Err_Handler Set oPopUp = CommandBars("Text").Controls("My Very Own Menu") "Delete individual commands on the PopUp menu. For Each oCtr In oPopUp.Controls oCtr.Delete Next off "Delete the PopUp itself. oPopUp.Delete "Delete individual practice regulates on the Text menu.Reënter: For Each oCtr In Application.CommandBars("Text").Controls If oCtr.Caption = "Boo&knote..." Then oCtr.Delete Exit For End If Next oCtr If MsgBox("This activity led to a readjust to your Add-In template." _ & vbCr + vbCr & "Recommend you save those changes currently.", vbInformation + vbOKCancel, _ "Save Changes") = vbOK Then ThisDocument.Save End If Set oPopUp = Nothing Set oCtr = Nothing Exit SubErr_Handler: Resume ReenterEnd Below

FaceID - Control ID

You might have noticed that I offered the FaceId residential or commercial property of the CommandBar controls in several instances. The FaceId specifies the look, not the feature, of a CommandBar switch. You have the right to pick from hundreds of FaceId numbers which are referenced in the FaceId.dot template that you have the right to downpack here: FaceId.dot

When you open up the FaceId.dot design template in Word 2007 and higher, the FaceIds are lived in on the ribbon Add-Ins tab. Ssuggest hove the mouse over the manage picture you are considering to use and review the ID in the popup.


*

Note: According to Word MVP Dave Rado, that developed FaceID.dot, tbelow are over 3000 FaceIds, but only 1707 actually have an associated picture, and fewer still have an linked photo discernable as unique. The FaceID.dot template offers only those that Dave considered "unique."

A control ID on the other hand also determines the built-in action for that manage. In this example, I provided the integrated Id "1589" for the "Insert Comment" manage and "758" for the "Add Bookmark" manage. These are the same regulate Ids as provided for the menu Insert>Comment and Insert>Booknote commands in Word 2003. I have included a list of manage Ids here: Control Ids.

Leveraging the Ribbon

I included some standard Ribbon customization to the worldwide layout add-in. When the add-in loads a new group with a pair of command also butlots are placed on the Add-Ins tab. You deserve to use these commands to quickly and also quickly fire the procedures that develop your custom menu controls or delete those controls. For more on personalizing the ribbon watch Customize the Ribbon (It doesn"t take Rocket Science).


*

*
Tbelow is an incontinual problem through this AddIn that I haven"t been able to remove. Sometimes when you run the BuildControls procedure for the initially time (either initially or for after making modifications) the controls are either not developed or don"t feature effectively. Each time that this has actually occurred, I have simply deleted the controls and run the BuildControls procedure a second time and also it works perfectly. As the little symbol indicates, I have given up.

For more on theme add-ins and also how to fill them, see: Organizing Your Macros/Template Add-ins at: Installing Macros

Custom CommandBar Control Icons

In cases wbelow for reasons of branding or when among the 1707 FaceIds simply isn"t sufficient, you deserve to create and also apply a custom image to the challenge of your CommandBar controls.

In the examples that follows, I will display you two VBA techniques for replacing the FaceId of the "My Number 1 Macro" manage via a tradition challenge characterized by a graphic photo file. Depending on your watch suggest, this might be heady or hefty stuff.

See more: My Snapchat Keeps Crashing Everytime I Take A Picture S, What Do I Do?


*
*
Here I have reput the image figured out by a FaceID via a practice icon mirroring the "Resting Anchor" symbol used in my work and webwebsite.

NoteYou gain what you pay for. I do not claim or pretend to be a graphic designer as my clumsy attempt to apply my "unsuitable" Resting Anchor graphic illustprices.


To usage a practice graphic file to a apply a custom "face" to CommandBar control we have to use the manage objects technique ".PasteFace" As the approach name suggests. .PasteFace sindicate pastes a copy of a photo file from the clipboard and uses it to collection the manage "confront."

Custom Icon Using External Graphic

The simplest method and one well suited for a static CommandBar icon, is to ssuggest insert a "suitable" outside graphic into a record, copy it, and also paste it to the regulate challenge.

The complying with VBA procedure inserts a defined graphic file right into a Word record and duplicates it as a snapshot to the clipboard:


VBA Script:
Copy to clipboard

Sub PasteMyFace()Dim oPopUP As CommandBarPopupDim oCtr As CommandBarControlDim oBtn As CommandBarButton "Put a snapshot on the clipboard. CopyShapeAsPicture "D:My PicturesMiscellaneous PicturesRestingAnchor.png" For Each oCtr In CommandBars("Text").Controls If oCtr.Caption = "My Very Own Menu" Then Set oPopUP = oCtr Set oBtn = oPopUP.Controls(1) "Paste it to the regulate challenge. oBtn.PasteFace If MsgBox("This action caused a adjust to your Add-In design template." _ & vbCr + vbCr & "Recommend you save those transforms now.", _ vbIndevelopment + vbOKCancel, "Save Changes") = vbOK Then ThisDocument.Save End If Exit For End If Nextlbl_Exit: Set oPopUP = Nothing: Set oBtn = Nothing Exit SubEnd Sub

Custom Icon Using a Transportable Document Stored Graphic

In the days of old (pre-Word 2007), you might create one or even more controls on a dummy toolbar bar (one you kept disabled and also hidden) and use tradition photo encounters to each of them manually or making use of the method over. You can then use the .CopyFace technique along with the .PasteFace technique to apply among those graphics to your working CommandBar. For example:

CommandBars("Dummy").Controls("Button1").CopyFaceCommandBars("Text").Controls("Bookmarks...").PasteFaceThisDocument.Saved = True

To make the last instance exciting, I am going to usage an actual picture file that is conserved (embedded) in the files OpenXMLLayout file package.

First I am going to create a "dummy" ribbon tab, group and also switch regulate. I will certainly store this tab from document users by establishing its "visible" property = false. Next I will certainly apply include and also use an outside .png format graphic file to the dummy switch control photo attribute.

Detailed actions for doing this is beyond the scope of this tips page. See: Customize the Ribbon and also my series on ribbon imperiods and also labels.

The RibbonXML that creates the dummy tab (as well as the 2 controls discussed above) is shown here:


*

At this suggest the theme global add-in file has a physical copy of the graphic file stored in the templates OpenXMLStyle file.


The last steps include:

Making a short-term copy of the theme file. Unzipping the theme OpenXMLStyle file to expose the reresource folders. Inserting the installed resource graphic right into a document. Copying that graphic as a snapshot to the clipboard. Pasting the clipboard content to the CommandBar control confront. Cleaning up what might appear to be a royal mess produced over.

While it might show up complex, via VBA it happens in the twinkle of an eye. The process needs some rather advanced VBA techniques that are too complicated to spell out below. Just download the Brief Cut Menu layout file using the attach at the end of the tips web page to see and also explore the compelled code.

Word 20132016 AutoCorrect Restored

NOTE - Do to consistent tinkering by Microsoft, this area might or may not be relevant. As of October 2020, Microsoft has supposedly "when again" restored The AutoCorrect shortreduced in the Office 365 (and probably various other versions) of Word. If you watch "Add to AutoCorrect" on the appropriate click food selection for a misspelled word without the add-in loaded, then of course you don"t need it. If you have actually been utilizing the add-in via Office 365 and also Word responds sluggishly, then you should soptimal utilizing the add-in and also rerelocate it from your startup folder.

Prompted by activity in various Word support forums, I"ve put together a method for restoring the "AutoCorrect" command also on the spelling error context food selection in Word 20132016. While not perfect, if you have actually involved rely on this function and if you can toleprice a slight occasional flicker of the computer mouse tip then this strategy can ease your pain.

Note: Microsoft can"t seem to get it right. First they violated great feeling ("If it isn"t broken, don"t fix it") and removed the function. Then they broke (twice) my attempts to fix what they have to have left alone in the first area.

Their many current interference developed with a Word 2016 update in May 2016. I do not understand if this is a sign that they are trying to regain this function but it shows up that they have actually tried to add an additional manage to this food selection captioned "Proofing." Well they failed, but their attempts resulted in an indexing error to show up in my procedure. Accordingly, I"ve modified the code to take care of that error and shown the add-in functions in the present versions (as of May 2016) of Word 2013 and 2016.

You can downfill the layout here and also put it in Word"s startup folder or load it manually. AutoCorrect Restored Aacquire.

Note: If/when Microsoft tinkers in this location I might have to revise the code aobtain. Check ago for updays if you endure worries. As of November 2016, Microsoft started releasing updays that recovered this feature, albeit in a various manner. Jury is still out regarding exactly how it is obtained and just how widespread the distribution will certainly be.


Note: To check out the red squiggly line under misspellings, encertain the option "Check spelling as you type" is checked in File>Options>Proofing>When correcting spelling and also grammar in Word.

Customize a ContextMenu wRibbonXML

One is never before too old to learn brand-new tricks. After practically 10 years of producing practice ribbons for my very own personal use and for others, I learned via Charles Kenyon and MVP Beth Melton that the subject ContextMenus debated in this tips web page deserve to additionally be customized (and also in many situations a lot easier) ssuggest utilizing RibbonXML.

In a previous illustration, I verified you a snippet of RibbonXML that I provided to store a document imbedded picture. Follows is the complete RibbonXML which currently additionally adds two buttons to a clean (otherwise unaltered) "Text" context food selection.

See more: # Windows 7 Eternity Loader Download, Windows 7 Eternity Download Iso Torent


As you should check out, the RibbonXML inserts the first button labeled "Button Inserted w/RibbonXML" before the built-in "Font..." control and appends a 2nd button labeled "Button Appended w/RibbonXML" at the bottom of the menu. Both butloads use a VBA "onAction" callback named "MyActionMacro." The first button shows a integrated image "_1" and the second shows the practice "Resting Anchor" picture disputed formerly.


That"s it! I hope you have actually discovered this tips web page valuable and also indevelopmental. You can download the template add-in I used in this Microsoft Word Help & Microsoft Word Tips page here: Customize Shortreduced Menu.


PAYMENTS/DONATIONS

Do you want to make a payment for consulting work or donate to assist supportthis site?