Set Focus to Internet Explorer Object in Visual Basic

后端 未结 4 920
别跟我提以往
别跟我提以往 2020-12-11 21:13

Does anybody know how to set focus onto an IE object with Visual Basic? I\'ve tried myieobject.SetFocus, but the compiler errors with this statement.

4条回答
  •  执念已碎
    2020-12-11 21:55

    set .Visible=True - if you've lost the screen somewhere in popups, you would have to loop through window titles to activate a specific title.

    Dim objShell As Shell
    Dim objIndex As InternetExplorer
    
    Set objShell = New Shell
    
    For Each objIndex In objShell.Windows
        If TypeName(objIndex.Document) = "HTMLDocument" Then
            If InStr(objIndex.Document.Title, "Stack Overflow") > 0 Then
                objIndex.Visible = True
                Exit For
            End If
        End If
    Next objIndex
    

    Here's what you can do with the IE object: MSDN

提交回复
热议问题