Using VBA to Navigate IE Frames

nairion

New Member
Joined
Dec 13, 2016
Messages
18
To begin, I know little about IE Elements and only slightly more about VBA code.
Here's what I have so far

Rich (BB code):
Sub internetlogon()
 Dim IE As Object
 Dim IE2 As Object
 Dim usr As Object
 Dim pwd As Object
 Dim Go As Object
 Dim frm As Object
 
 
 Set IE = CreateObject("InternetExplorer.Application")
 IE.Visible = True
 'Go to this Web Page!
 IE.Navigate "https://www.chasesoftware.com/itok/login.aspx"
 'Check for good connection to web page loop!
 Do
 If IE.ReadyState = 4 Then
 IE.Visible = False
 Exit Do
 Else
 DoEvents
 End If
 Loop
 'Wait for window to open!
 Application.Wait (Now + TimeValue("0:00:01"))
 IE.Visible = True
 'Send logon information
 Application.Wait (Now + TimeValue("0:00:01"))
    Set usr = IE.document.getElementById("usr")
    usr.Value = "MY LOGIN NAME"
    
    Set pwd = IE.document.getElementById("pwd")
    pwd.Value = "MY PASSWORD"
    Set frm = IE.document.forms("form1")

    Set Go = IE.document.getElementById("btnLogin")
    Go.Click
'Navigate to a link in a framed table "Work Orders"
 Application.Wait (Now + TimeValue("0:00:05"))
IE.document.getElementById("barChase_5_Item_1").Click

End Sub

The element I'm trying to get to in inside of a frameset "contents", inside of a form "form2", inside of a div "barChase" (versus "barChase_hidden"), inside of a table "barchase_Group_1_Group", and finally you get to my item "barChase_5_Item_1"

I get the error -2147417848 (80010108)
The Object invoked has disconnected from its clients.

I have 2 issues: (ok, probably a lot more than that, but here's some hints)
1. In between
Code:
Set Go = IE.document.getElementById("btnLogin")
    Go.Click
and
Rich (BB code):
IE.document.getElementById("barChase_5_Item_1").Click
the webpage actually opens a new window with a new URL and closes the old window. I don't know how to set my variable IE to the new URL value.

2. I'm certain there's some issue with locating barChase_5_Item_1 inside the mess of hierarchy. I can't post the actual webpage as it's work but if it would help to see the entire code, I can post it below. (it's long)

Any hints to interacting with frames like that?
 

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top