vb6.0/vba [vb6.0/vba] 인터넷익스플로워 띄우기 및 검색하기/FindIE
페이지 정보

본문
단순히 인터넷 익스플로워를 띄우는 방법
아래는 열려있는 창이 있으면 열려있는 익스플로워의 첫번째 창을 이용해서 
네이버 검색을 하는 예제입니다.
naver.com에서 "네이버"를 검색해서 관련 연관검색어를 메세지 박스로 띄워줍니다.
Dim IE As Object
Sub 버튼()
    If IE Is Nothing Then Set IE = FindIE
    On Error Resume Next
    With IE
        .Visible = True
        .Navigate2 "naver.com"
        If Err Then Set IE = Nothing: 버튼: Exit Sub
        Do While .Busy = True Or .ReadyState <> 4
            DoEvents
        Loop
        .Document.all("query").Value = "네이버"
        .Document.all("search_btn").Click
        Do While .Busy = True Or .ReadyState <> 4
            DoEvents
        Loop
        MsgBox .Document.all("nx_related_keywords").innerTEXT
    End With
End Sub
Function FindIE() As Object
    Dim obj As Object, Count&, URL$, Title$, x&
    Set obj = CreateObject("Shell.Application")
    On Error Resume Next
    Count = obj.Windows.Count
    For x = 0 To (Count - 1)
        URL = obj.Windows(x).Document.Location
        Title = obj.Windows(x).Document.Title
        If TypeName(obj.Windows(x).Document) = "HTMLDocument" Then
            Set FindIE = obj.Windows(x)
            Exit For
        End If
    Next
    If FindIE Is Nothing Then Set FindIE = CreateObject("InternetExplorer.Application")
End Function
- 이전글[vb6.0/vba] 웹브라우져(InternetExplorer)를 이용한 다음 지도검색 20.03.16
- 다음글[vb6.0/vba] Find IE / 열려있는 익스플로워(InternetExplorer) 창을 찿아 URL을 바꿈 20.03.16
댓글목록
등록된 댓글이 없습니다.





