I'm trying to add a check to a checkbox on an intranet page. I've tried using the below code with no luck,
Code
Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer
Sub Website_Login_Test()
Dim oHTML_Element As IHTMLElement
Dim sURL As String
On Error GoTo Err_Clear
sURL = "http://server/webclient/h3cF1ztjAPkEPD"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.timeout = 60
oBrowser.navigate sURL
oBrowser.Visible = True
Do
' Wait till the Browser is loaded
Loop Until oBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = oBrowser.document
'HTMLDoc.all.username.Value = Range("A1")
HTMLDoc.all.username.Value = Sheets("Export").Range("A1")
HTMLDoc.all.password.Value = "password"
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For
Next
Application.Wait (Now + TimeValue("0:00:05"))
ie.Visible = True
ie.document.forms(0).all("BATCH-EXPORT").CheckBox = True
' oBrowser.Refresh ' Refresh If Needed
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
Display More
below is the webpage html I'm trying to reference.
<TR style="BACKGROUND-COLOR: #efefef" man_type="Item" man_level="0" man_kids="webclient/h3cF1ztjAPkEPD? TC_file=common/data/wsochildren.xml"
man_tag="h3cF1ztjAPkEPD" man_name="BATCH-EXPORT" man_link="webclient/h3cF1ztjAPkEPD" man_baseclasslist="Item%2CWorkspaceObject"
man_class="Item" man_parent_uid="h3cF1ztjAPkEPD" man_uid="h3cF1ztjAPkEPD" man_object_string="BATCH-EXPORT" man_expanded="true"
man_collapsed="null"><TD style="TEXT-ALIGN: center">
<INPUT type=checkbox value="on"></TD>