Click here to Skip to main content
13,597,589 members
Click here to Skip to main content
Add your own
alternative version


17 bookmarked
Posted 1 Jul 2003

Macro for Google Search in VS.NET

, 1 Jul 2003
Rate this:
Please Sign up or sign in to vote.
A simple-yet-powerful macro for VS.NET to search for selected text in google.


You know, in these days the most popular internet site is Google. When I programmed, I always found resource at Google. But when I wanted to find resouces, I ran Internet Explorer, typed '' and typed keywords. It was very boring. So I made MACRO that find resources on google and shows its results in VS.NET's Web browser.

1. Select a key word or sentence (string).

2. Execute the 'GoogleSearch' macro. You can directly execute in Macro Explorer where you can see it or register it as shortcut. If you execute the macro, the Web browser will be shown.

Using the Code

This macro is very simple. You can learn all about it from the source code. For your convenience, I have added some comments.

The following is macro's source code.

Option Strict Off
Option Explicit Off
Imports EnvDTE

Public Module SMILE

    Sub GoogleSearch()
        Dim strUrl As String
        Dim selection As TextSelection = DTE.ActiveDocument.Selection()

        ' If user didn't select text, 
        ' show assert message box
        If selection.Text <> "" Then
            ' Google Search!
            strUrl = "" + selection.Text
            ' Navigate it!
            DTE.ExecuteCommand("View.URL", strUrl)
            MsgBox("Select Text to find")
        End If
    End Sub

End Module

Points of Interest

As you know, VS.NET's IDE is very interesting and powerful. You can extend the VS.NET IDE however you want. If you check VS.NET's sample macro source file, you can learn from it. Try it now.


  • 06-02-2003 - Initial upload


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Wooseok Seo
Software Developer (Senior)
Korea (Republic of) Korea (Republic of)
Woo Seok Seo have been a Microsoft MVP for 7 years and have translated several books into Korean. Author of C# Programming for Beginner (DevPress, 2001), he is interested in Debugging techniques and .NET technology. Get in touch with Woo Seok Seo at

You may also be interested in...

Comments and Discussions

News Pin 14:44
suss 14:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04 | 2.8.180621.3 | Last Updated 2 Jul 2003
Article Copyright 2003 by Wooseok Seo
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid