I tried to run this the first time without any documents open and it threw an error, so I made a small mod to the original code to prevent VS from whining at me under those, probably limited, circumstances:
Dim url As String = "www.google.com/search?q=MSDN"
If DTE.ActiveDocument IsNot Nothing Then
Dim searchFor As TextSelection = DTE.ActiveDocument.Selection()
If searchFor.Text <> "" Then
url = "www.google.com/search?q=MSDN+" + searchFor.Text
url = "www.google.com/search?q=MSDN"
I also like the idea of having it open in my browser rather than a new window in VS.