VBA IE check and uncheck the checkbox with same-name and different-values "document of object iwebbrowser2 failed" error

Ray_Dem

New Member
Joined
Jul 18, 2022
Messages
10
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
As you can see i tried many different codes but i'm still getting "document of object iwebbrowser2 failed" error and i have no idea why please help

[/ICODE]
My HTML Code

<tr>
<td width="4%" align="left" valign="middle"></td>
<td width="96%" align="left" valign="middle"><font face="arial" size="1.5">
<input align="top" type="checkbox" name="R_CustInst" value="51">
<b>BANK2</b></font></td>
</tr>
<tr>
<td width="4%" align="left" valign="middle"></td>
<td width="96%" align="left" valign="middle"><font face="arial" size="1.5">
<input align="top" type="checkbox" name="R_CustInst" value="52">
<b>BANK1</b></font></td>
</tr>
[/CODE]

My VBA Code

VBA Code:
Sub test()
    
    Set sht = ThisWorkbook.Sheets("Sheet1")
    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Visible = True
    IE.Navigate "http://"
    
    Do
    If IE.ReadyState <> 4 Then
    IE.Visible = True
    Exit Do
    Else
    DoEvents
    End If
    Loop
    
    'Dim chBox As Object
    '
    '    Set chBox = IE.document.getElementsByName("R_CustInst")
    '
    '    chBox(52).Checked = True
    IE.document.querySelector("[name=R_CustInst][value='52']").Click
    
    'IE.document.getElementsByAll("[name=R_CustInst][value=52]").FireEvent
    '<input align="top" type="checkbox" name="R_CustInst" value="52">
    'IE.document.all("R_CustInst")(52).Checked = True
    'IE.document.getElementsByTagName("BANK1").Click
    'IE.document.getElementsByValue("52")
    'IE.document.getElementByAttribute("Type").Click
    'IE.document.getElementById("Type").Click
    'IE.document.querySelector("[name=R_CustInst][value='52']").Click


    Set IE = Nothing
    
    End Sub
[ICODE]

i'm new to this and i'm a mess been at it long and i give up Please help PLEASE! 
What i want to do is => On that same site i have to tick on 4 Check box and 2 radio button to fetch the table data,than copy paste the acquired table in excel sheet but i can't get pass even a single one.
if nothing work how do i get the table data from already checked, submitted and fetched data table from open browser to Excel sheet 
Can we not use "BANK1" or "BANK2" names to get the elements as they are the Unique '<b>BANK1</b>' like #input where tag is BANK1 or something. i'm not sure what am i saying but maybe?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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