5,696,038 members and growing! (14,644 online)
Email Password   helpLost your password?
General Programming » Macros and Add-ins » Macros     Intermediate

Macro for Google Search in VS.NET

By Wooseok Seo

A simple-yet-powerful macro for VS.NET to search for selected text in google.
C++, VB.NET 1.0, .NET 1.1, NT4, Win2K, WinXP, Win2003, Windows, .NET, Visual Studio, Dev

Posted: 1 Jul 2003
Updated: 1 Jul 2003
Views: 24,768
Bookmarked: 12 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
8 votes for this Article.
Popularity: 2.71 Rating: 3.00 out of 5
0 votes, 0.0%
1
2 votes, 25.0%
2
3 votes, 37.5%
3
2 votes, 25.0%
4
1 vote, 12.5%
5

Introduction

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 'www.google.com' 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 = "www.google.co.kr/search?q=" + selection.Text
            ' Navigate it!

            DTE.ExecuteCommand("View.URL", strUrl)
        Else
            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.

History

  • 06-02-2003 - Initial upload

License

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


Woo Seok Seo have been a Microsoft MVP for three 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 wooseok.seo@gmail.com
Occupation: Web Developer
Location: Korea, Republic Of Korea, Republic Of

Other popular Macros and Add-ins articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 1 of 1 (Total in Forum: 1) (Refresh)FirstPrevNext
Newshttp://remove-ink-stain.tangoing.info/susshttp://remove-ink-stain.tangoing.info/15:44 4 Dec '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 1 Jul 2003
Editor: Heath Stewart
Copyright 2003 by Wooseok Seo
Everything else Copyright © CodeProject, 1999-2008
Web20 | Advertise on the Code Project