none
HTMLDocument focused not working RRS feed

  • Question

  • Hi,

    Want to make a access database application that can fill field in internet explorer.

    For this I need to know the IE tab or window that has the actual input focus

    I have tried this:

    Public Sub test1()
    Dim shellWins As shellWindows
    Dim IE As InternetExplorer
    Dim Doc As HTMLDocument
    
    
    Set shellWins = New shellWindows
    For Each IE In shellWins
        Set Doc = IE.Document
        Debug.Print (IE.focused)
    Next
    End Sub
    

    but then I get the message that this property (focused) is not supported.

    I can not find any alternative.

    any suggestions??

    thanks!

    Thursday, May 4, 2017 9:01 AM

All replies

  • Connecting to an existing instance of IE is difficult.  What you usually do is have your program create an instance of IE and open a specific page.  This way you have 1 tab and can select the DOM element you want.
    Thursday, May 4, 2017 10:14 PM
  • thanks but this is not an option.

    in a complex web based application I want to offer to enter standard text in various pages. so depending on the page displayed I need to enter text. selecting a page and web element is no problem. I just need to know witch page is active (has focus).

    Friday, May 5, 2017 5:06 AM

  • I've never been able to connect to an existing web browser but I gave up after 5 hours or so.  I finally set it up so the program started the web browser then the user could open tabs and navigate to different pages.  I used Selenium.
    Friday, May 5, 2017 1:36 PM