Consulting

Results 1 to 3 of 3

Thread: VBA Get InternetExplorer Object

  1. #1

    VBA Get InternetExplorer Object

    Hi Guys,

    Now we have the vba code able to retreive data from a webpage is there anyway to start the vba code doing this from an internet explorer window that is already open?

    Perhaps a reference by window title? e.g this one is called:

    "VBA Express Forum - Post New Thread - Windows Internet Explorer"

    Thanks

  2. #2

    GetObject Security Issue

    Good Afternoon.

    Because of the connectivity involved with Internet Explorer and it's ability to run ActiveX Controls and COM Objects, using GetObject is not permitted. As you've seen in your other posts, CreateObject is completely legitimate, however.

    As with almost everything, there is a workaround using the Shell Object.

    References:
    Microsoft Internet Controls
    Microsoft Shell Controls and Automation

    [VBA]

    Sub GetInternetExplorer()
    Dim appShell As Shell
    Dim appIE As InternetExplorer
    Dim appWindow As appect
    Set appShell = New Shell

    For Each appWindow In appShell.Windows
    If TypeName(appWindow.Document) = "HTMLDocument" Then
    Set appIE = appWindow
    Debug.Print appIE.Name & ": " & appIE.LocationURL
    End If
    Next appWindow
    End Sub
    [/VBA]

    Enjoy.
    Scott
    You don't understand anything until you learn it more than one way. ~Marvin Minsky

    I never teach my pupils; I only attempt to provide the conditions in which they can learn. - Albert Einstein

  3. #3

    GetObject Security Issue

    Good Afternoon.

    Because of the connectivity involved with Internet Explorer and it's ability to run ActiveX Controls and COM Objects, using GetObject is not permitted. As you've seen in your other posts, CreateObject is completely legitimate, however.

    As with almost everything, there is a workaround using the Shell Object.

    References:
    Microsoft Internet Controls
    Microsoft Shell Controls and Automation

    [VBA]

    Sub GetInternetExplorer()
    Dim appShell As Shell
    Dim appIE As InternetExplorer
    Dim appWindow As appect
    Set appShell = New Shell

    For Each appWindow In appShell.Windows
    If TypeName(appWindow.Document) = "HTMLDocument" Then
    Set appIE = appWindow
    Debug.Print appIE.Name & ": " & appIE.LocationURL
    End If
    Next appWindow
    End Sub
    [/VBA]

    Enjoy.
    Scott
    You don't understand anything until you learn it more than one way. ~Marvin Minsky

    I never teach my pupils; I only attempt to provide the conditions in which they can learn. - Albert Einstein

Posting Permissions

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