Results 1 to 3 of 3

Thread: [RESOLVED] [Access/Excel] Finding an open IE and...

  1. #1

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Resolved [RESOLVED] [Access/Excel] Finding an open IE and...

    ...how to find more than one should there be say three open on a desktop


    how would I do this using basic controls and VBA in Access/Excel.

    The Posts on here and on the interweb appear to create new ie instances.

    Has anyone done this?
    Last edited by Ecniv; Nov 7th, 2008 at 03:57 AM.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  2. #2
    Fanatic Member dmaruca's Avatar
    Join Date
    May 2006
    Location
    Jacksonville, FL
    Posts
    577

    Re: {Access/Excel] Finding an open IE and...

    Yes, I've done this. You have to loop through the SHDocVw.ShellWindows object. That will contain all IE and explorer windows open. This short sub gets the very first IE window. The reference for early binding is "Microsoft Internet Controls."

    Code:
    Private Sub GetIeWindow(ByRef ie As InternetExplorer)
        Dim SW As New SHDocVw.ShellWindows
        Dim i As Long
        Dim s As String
        
        i = SW.Count
        
        For i = 0 To i - 1
            On Error Resume Next
            s = SW(i).Document.Title
            If Err.Number > 0 Then
                Err.Clear
            Else
                Set ie = SW(i)
                Exit For
            End If
        Next
        
    End Sub

  3. #3

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: [Access/Excel] Finding an open IE and...

    Thanks for that. I found a similar post:

    Other post on another place

    Code:
        Dim sws As SHDocVw.ShellWindows
        Dim ie As SHDocVw.InternetExplorer
    
        Set sws = New SHDocVw.ShellWindows
        For Each ie In sws
    
            Debug.Print ie.LocationURL
    
        Next
    
        Set ie = Nothing
        Set sws = Nothing
    Then I came up with the above. However, the thing I wanted to do turns out not o be a web page, but to be an SWE (flash?) so I don't think I can do what I wanted to do.

    I will use this at some point in the future though so thank you for posting



    How wouold we find these things? Seems not to be easily found online through ms... in fact the msdn site seems to have changed...

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width