Written by Allen Wyatt (last updated September 11, 2023)
This tip applies to Word 2007, 2010, 2013, 2019, and Word in Microsoft 365
When working in a document, Lewis can select a word or phrase, right-click on it, and choose the "Search with Bing" option. He's not happy with Bing's search results and would much prefer to search with a different search engine, such as Google. Lewis wonders if there is a way to add other search engines to the right-click menu or, perhaps, change the "Search with Bing" option to use a different search engine.
The very fact that Lewis has a "Search with Bing" option on the right-click Context menu tells me that he is using either Word 2010 or Word 2013. This particular option doesn't exist in either Word 2007 or Word 2016 or a later version.
In both Word 2010 and Word 2013 you can edit the Windows Registry to modify the "Search with Bing" option. Editing the Registry should be done carefully, as one misstep could result in an unusable system. (If you need a refresher on how to edit the Registry, including how to start the Registry Editor, see this tip on the WindowsTips site.) Follow these steps to make the modification:
HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Word\Data
Now, go ahead and select some text. When you right-click on it, the Context menu option has changed from "Search with Bing" to "Search with Google." If, at some point (and for some reason) you want to stop using Google and again start using Bing, just delete the two Registry entries you created in these steps.
The foregoing Registry modification won't work in Word 2007 or Word 2016 or a later version. As already mentioned, neither of these versions include the "Search with Bing" option. (Word 2016 and later versions includes a "Smart Lookup" option, but no "Search with Bing" option.) The only way that we've been able to find to add a "Search with Google" option to the Context menu is to add some rather hefty macros to your document. The following, for instance, is a set of macros that will add the option on a Word 2007 system. These should be added to a regular VBA module:
Option Explicit Dim oPopUp As CommandBarPopup Dim oCtr As CommandBarControl Private pWebAddress As String Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _ ByVal lpOperation As String, ByVal lpFile As String, _ ByVal lpParameters As String, ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Sub 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 top of the "Text" short-cut menu Set oPopUp = CommandBars("Text").Controls.Add(msoControlPopup, , , 1) With oPopUp .Caption = "Search With Google" .Tag = "custPopup" .BeginGroup = True End With Set oBtn = oPopUp.Controls.Add(msoControlButton) With oBtn .Caption = "Google" .FaceId = 940 .Style = msoButtonIconAndCaption .OnAction = "WebPage" End With Set oBtn = Nothing Add_Individual: 'Or add individual commands directly to menu Set oBtn = CommandBars.FindControl(Tag:="custCmdBtn") If Not oBtn Is Nothing Then Exit Sub 'Add control using built-in ID 758 (Boo&kmarks...) Set oBtn = Application.CommandBars("Text").Controls.Add(msoControlButton, 758, , 2) oBtn.Tag = "custCmdBtn" If MsgBox("This action caused 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 = Nothing lbl_Exit: Exit Sub End Sub
Sub RemoveContextMenuItem () 'Make command bar changes in Add-In template CustomizationContext = ThisDocument.AttachedTemplate On Error GoTo Err_Handler Set oPopUp = CommandBars("Text").Controls("Search With Google") 'Delete individual commands on the PopUp menu. For Each oCtr In oPopUp.Controls oCtr.Delete Next 'Delete the PopUp itself. oPopUp.Delete 'Delete individual custom commands on the Text menu. Reenter: For Each oCtr In Application.CommandBars("Text").Controls If oCtr.Caption = "Boo&kmark..." Then oCtr.Delete Exit For End If Next oCtr If MsgBox("This action caused 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 oCtr = Nothing Exit Sub Err_Handler: ' MsgBox Err.Number Resume Reenter End Sub Public Sub WebPage() pWebAddress = "https://www.google.com/search?q=" & Selection.Text Call NewShell(pWebAddress, 3) End Sub Public Sub NewShell(cmdLine As String, lngWindowHndl As Long) ShellExecute lngWindowHndl, "open", cmdLine, _ Selection.Text, Selection.Text, 1 End Sub
In order to add the "Search with Google" option to the Context menu, simply run the BuildControls macro. If you later want to remove the option, you can run the RemoveContextMenuItem macro.
These macros are based on work done by Greg Maxey at his website, here:
https://gregmaxey.com/word_tip_pages/customize_shortcut_menu.html
As mentioned, the macros will work only on a Word 2007 system. For reasons that Greg discusses on his website, they will not work on Word 2016 or later systems without some rather major modifications, and they may not be stable even after the modifications because of changes that Microsoft continues to make.
Note:
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (166) applies to Microsoft Word 2007, 2010, 2013, 2019, and Word in Microsoft 365.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
If you intend to generate a Web page from your document, you need to be concerned with the fonts that Word will use. ...
Discover MoreWhen using Word to create content that will end up on the Web, it is helpful to know the probable screen resolution of ...
Discover MoreWant to save your document as a Web page? It's easy to do in Word; almost as easy as saving your document normally.
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2018-11-27 11:11:51
yiming
Solved the problem myself. I'm using Window 10. By selecting "Unicode UTF-8 for world wide language support" under "Language for non-Unicode programs" > "Change system locale", I was able to use this fantastic macro for Unicode text.
2018-11-26 07:39:35
yiming
I'm using Word 2007, it works perfectly. Thank you.
But unfortunately, it is not Unicode compatible and I am unable to use it to search Chinese text. Can the code be modified to be Unicode compatible?
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments