Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

List all Internet explorer windows in admin mode with CreateObject("Shell.Application").Wi

List all Internet explorer windows in admin mode with CreateObject("Shell.Application").Wi

List all Internet explorer windows in admin mode with CreateObject("Shell.Application").Wi


I need some help on vbscript on the folowing point (on win7,IE11): I have discovered that when creating two (or more) IE object, when going in admin mode, only the first one is seen with CreateObject("Shell.Application").Windows

To give an example of the problem, in the following code i run a sub called IEOpen() that only creates 2 IE object by the usual way and navigate for example to bing and google. Then list those windows by using a loop on CreateObject("Shell.Application").Windows.

The first run is made normally and both windows are detected, but when relaunch the script under admin mode, when recalling the same Sub, only the first IE Object is detected:

CODE --> vbscript

path    = CreateObject("WScript.Shell").CurrentDirectory 

  If WScript.Arguments.length = 0 Then    

     ' First try, running not as admin

     'relaunch script as admin
      Set ShellApp = CreateObject("Shell.Application")
      ShellApp.ShellExecute "wscript.exe", Chr(34) & _
            WScript.ScriptFullName & " " & Chr(34) & _
            " " & Chr(34) & path &  Chr(34),"", "runas", 1
  End If

Sub Start
   'Run same script again but in admin mode
end sub

Sub IEOpen()
    ' Create 2 IE Object
      Set IE1 = WScript.CreateObject("InternetExplorer.Application")
      Set IE2 = WScript.CreateObject("InternetExplorer.Application")
      IE1.Navigate "www.bing.com"
      IE2.Navigate "www.google.com"
      IE1.Visible = true
      IE2.Visible = true
     ' list all the windows opened, including IE windows:
     ' When runing this sub in admin mode, the ...Windows.count is lower as second IE is not seen

      msgbox CreateObject("Shell.Application").Windows.count

      For Each win In CreateObject("Shell.Application").Windows
           msgbox win.LocationURL
End Sub 

In my complete code i need to have 2 differents IE and run as admin, so i'm stuck as i can't access to the properties of the second IE Object. Do you know what i'm doing wrong or if this problem can be bypassed ? Thank you

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close