AppActivate an opened Internet Explorer tab (VBScript) RRS feed

  • Question

  • Probably the wrong forum as I am asking about VBScript in particular.

    I need a VBScript to activate (bring to the front and set focus) to a previously opened Internet Explorer tab.

    From the following forum post I am able to step through all the tabs on the IE browser but have not been able to actually give it focus in order to SendKeys:


    Code I have in place is:

    Dim objShell
    Dim AllWindows
    Dim win
    Dim winItem
    Dim wshShell

    Set wshShell = WScript.CreateObject("WScript.Shell")
    Set objShell = CreateObject("Shell.Application")
    Set AllWindows = objShell.Windows

    For Each win in AllWindows
       If win.LocationUrl="https://social.msdn.microsoft.com" Then
         Wscript.echo  win.LocationUrl
         Wscript.echo  win.LocationName
         Set winItem = AllWindows.Item

         ' Here is where I need to set focus and commence sending keys to the browser Window

       End If

    What information do I need from Shell.Application do I need for WScript.Shell.AppActivate ??

    And before anyone suggests AutoHotKeys, IT is not letting me install it.  :(

    Tuesday, October 27, 2020 8:52 PM


All replies

  • Hi Mark Weidner,

    Thank you for posting here.

    Since your question is more related to VBScript, I have moved the thread to 'where is the forum for' forum to help you find the correct forum to go ask questions.

    Visual Basic forum is a Question & Answer system for VB.Net related questions. Thank you for your understanding.

    Best Regards,

    Xingyu Zhao

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, October 28, 2020 1:41 AM
  • I'd try asking for help over here.




    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    • Proposed as answer by Guido Franzke Wednesday, October 28, 2020 6:44 AM
    • Marked as answer by Guido Franzke Tuesday, November 3, 2020 9:17 AM
    Wednesday, October 28, 2020 2:35 AM