Searching with a Different Search Engine

Written by Allen Wyatt (last updated September 11, 2023)
This tip applies to Word 2007, 2010, 2013, 2019, and Word in Microsoft 365


2

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:

  1. Exit Word.
  2. Start the Registry editor.
  3. Locate and select the following data key. (This data key, as shown below, is for Word 2013. If you are using Word 2010, change 15.0 to 14.0.)
  4.      HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Word\Data
    
  5. Choose Edit | New | String Value. The Registry Editor adds a new string value to the right side of the Registry and allows you to immediately enter its name.
  6. Name the new string value "SearchProviderName" (without the quotes).
  7. Right-click on the newly added string value and choose Modify from the resulting Context menu. The Registry Editor displays the Edit String dialog box.
  8. In the Value Data field enter "Google" (without the quotes.)
  9. Click OK. The information in the Registry Editor is updated.
  10. Again choose Edit | New | String Value. The Registry Editor adds another new string value to the right side of the Registry and you can, again, change its name.
  11. Name the new string value "SearchProviderURI" (without the quotes).
  12. Right-click on the newly added string value and choose Modify from the resulting Context menu. The Registry Editor displays the Edit String dialog box.
  13. 12. In the Value Data field enter "https://www.google.com/search?q=" (again, without the quotes).
  14. Click OK. The information in the Registry Editor is updated.
  15. Close the Registry editor.
  16. Restart Word.

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:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

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.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Read-Only Embedded Fonts

If you receive a document from somebody else, you might not be able to edit it if the document contains fonts that you ...

Discover More

Precise Ruler Adjustments

When adjusting the position of things on the Ruler (like tab stops), you can use the Alt key to get very precise in your ...

Discover More

Sequentially Numbering Footnotes

If you have a document with lots of footnotes, you might notice that some of those footnotes are not in numerical order, ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!

More WordTips (ribbon)

Specifying Monitor Resolution

When using Word to create content that will end up on the Web, it is helpful to know the probable screen resolution of ...

Discover More

Saving a Document as a Web Page

Want to save your document as a Web page? It's easy to do in Word; almost as easy as saving your document normally.

Discover More

Setting Web Fonts

If you intend to generate a Web page from your document, you need to be concerned with the fonts that Word will use. ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 2 + 2?

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?


This Site

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.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.