VB cannot access controls of an existing IE browser

I need to have a VB application to press a button in an existing webpage open in a Internet Explorer 10 browser. I cannot (not allowed) to run the company app from within a VB WebBrowser control. Unfortunately my code does not seem to be working and I'm getting a VB error of "Access Denied". My goal is to press a button within the existing IE browser.

        Dim SWs As New SHDocVw.ShellWindows
        Dim oSiteManager As BaseSite
        Dim oIE As SHDocVw.InternetExplorer
        Dim oPage As String
        Dim bFoundWindow As Boolean = False

' ***** This part works - oIE does indeed get the correct Internet Explorer window (verified by get oIE InnerHtml
        For Each oIE In SWs
            If oIE.Name = "Windows Internet Explorer" Then
                ' ignore empty name
                If oIE.LocationName <> "" Then
                    ' ignore about tabs
                    If oIE.LocationURL <> "about:Tabs" Then
                        ' ignore about blank
                        If oIE.LocationURL <> "about:blank" Then
                            ' save the data somewhere...
                            ' txtStatus.Text = txtStatus.Text + oIE.LocationName & ", URL=" & oIE.LocationURL + vbCrLf

                            ' oPage = oIE.Document.body.InnerHTML
                            If oIE.LocationURL.IndexOf("/status/") > -1 Then
                                oPage = oIE.Document.body.InnerHTML
                                txtStatus.Text = txtStatus.Text + oPage + vbCrLf
                                Exit For
                            End If
                        End If
                    End If
                End If
            End If

        If Not IsNothing(oIE.Document.body) Then

' ******* The next statement is needed because the oIE is not
' This next statement does NOT throw an error, but while stepping thru it has values of "Access Denied". I cannot use the oIE control directly to access the GetElementsByTagName function (tried it) bec I got a "Cannot implicitly convert type 'System.__ComObject' to 'System.Windows.Forms.HtmlElement'") error

            Dim f1 As mshtml.IHTMLWindow2 = CType(oIE.Document.frames.item(0), mshtml.IHTMLWindow2)
            Dim theElementCollection As HtmlElementCollection = f1.document.GetElementsByTagName("input")

            For Each curElement As HtmlElement In theElementCollection
                Dim controlValue As String = curElement.GetAttribute("Value").ToString
                If controlValue = "Resume" Then
                End If

        End If
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

All IE10 windows are sandboxed for security purposes, so that's why you're getting the access denied error. You won't be able to run a VB script that controls anything inside an IE window -- that's the same behavior as a virus would use, and it will always get blocked

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.