Imports EnvDTE Public Module Search Sub GoogleSearch() Dim strUrl As String Dim selection As TextSelection = DTE.ActiveDocument.Selection() If selection.Text <> "" Then strUrl = "www.google.com/search?q=" + selection.Text DTE.ExecuteCommand("View.URL", strUrl) Else MsgBox("Select Text first to Search") End If End Sub End Module
A Google search macro - you can search Google yourself and I am sure you'll find a number of examples; probably some are more sophisticated than this one. But as a big proponent of the "Less is More" philosophy, I think this code is "just enough" to get the job done right!
First, fire up Visual Studio.NET, and choose Tools->Macros->MacroExplorer (alt -T -M -M for you shortcute dewds). You should see the Macro Explorer window, and it most likely will show "My Macros" and "Samples" nodes.
Next, right click on the topmost Macros node and choose "New Macro Project", and give it a nice name like "GoogleSearch". Double-click on your new node and it should open up the edit window on the module. Paste in the following code:
For more details, visit http://www.eggheadcafe.com/articles/20040423.asp
|
| Author: Sebastian 13 Jun 2008 | Member Level: Gold Points : 1 |
This is very informative. Thanks for sharing the details.
|