1. 도구 -> 매크로 ->매크로 IDE (ALT + F11)

2. MyMacros 에 마우스 오른쪽 버튼 클릭을 한 뒤 추가 -> 모듈 추가

3. 모듈이름으로 아무거나(ex. Google) 입력하고 확인

4. 방금 만든 모듈 이름을 더블클릭한 뒤 안의 코드를 지우고 아래의 코드를 복사해서 붙여넣는다.

Option Strict Off
Option Explicit Off
Imports EnvDTE

Public Module Google

    Public 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.WebBrowser", strUrl)
        Else
            MsgBox("Select Text to find")
        End If
    End Sub

End Module

 

5. 코드를 입력한 창을 저장하고 닫는다.

-- 다음은 키보드 매핑


6.도구->옵션->환경의 키보드 선택

7. 다음 문자열을 포함하는 명령 표시란에 3번에 입력한 모듈이름 입력해서 매크로 명령어 찾고

9. 원하는 단축키 할당

10. 코드내에서 찾고자 하는 단어를 블록 설정한 뒤 위에서 정해준 단축키를 눌르면 Google에서

 찾기가 됩니다. 


ps> strUrl을 바꾸면 네이버나 다음등도 가능합니다.

ps> 위 강조 부분은 인터넷상에 " DTE.ExecuteCommand("View.URL", strUrl) " 로 되어 있는데

view.url로 할경우 VS2005에서 실행되지 않습니다.





profile

Happy SQLER~!

NEXON NDOORS DBA. 

SQLER.com Sysop / SQLTAG Vice-master / Microsoft SQL Server Frontier Group.

E-Mail: alucard@naver.com / Mobile: +82 10-5665-8554

http://www.sqler.comhttp://www.sqltag.org / http://alucardkang.tistory.com