I am currently trying to click the following text input box based on its id: dp1571754895218 in VBA
<input title="INVOICEDATE" class="half-filter hasDatepicker" id="dp1571754895218" style="margin-right: 2px; opacity: 1;" type="text" placeholder="From" data-bind="attr: { placeholder: 'From', title: $data.Key, 'data-tabgroup': 'itemlistfilter', 'data-tabgroupindex': ($index() + 1) }, datepicker: $data.Range.From, datepickerOptions: { dateFormat: $root.jQformatDate($data.Format) }, style: { 'opacity': $parent.multiSearchOn() ? '0.3' : '1' }" data-tabgroup="itemlistfilter" data-tabgroupindex="7">
What I have tried so far is this:
Dim date1 As Object
Set html = ie.document
Set date1 = html.getElementById("dp1571754895218")
For Each l In date1
If l.className = "half-filter hasDatepicker" Then
l.Click
Exit For
End If
Next
But I keep getting the following error: Run-time error '424': Object required. I already have the correct references too. What am I doing incorrectly?
Edit: For QHarr, here are both html codes placeholder = To:
<input title="INVOICEDATE" class="half-filter hasDatepicker" id="dp1571841444746" style="opacity: 1;" type="text" placeholder="To" data-bind="attr: { placeholder: 'To', title: $data.Key, 'data-tabgroup': 'itemlistfilter', 'data-tabgroupindex': ($index() + 1.1) }, datepicker: $data.Range.To, datepickerOptions: { dateFormat: $root.jQformatDate($data.Format) }, style: { 'opacity': $parent.multiSearchOn() ? '0.3' : '1' }" data-tabgroup="itemlistfilter" data-tabgroupindex="7.1">
Placeholder = From:
<input title="INVOICEDATE" class="half-filter hasDatepicker" id="dp1571841444745" style="margin-right: 2px; opacity: 1;" type="text" placeholder="From" data-bind="attr: { placeholder: 'From', title: $data.Key, 'data-tabgroup': 'itemlistfilter', 'data-tabgroupindex': ($index() + 1) }, datepicker: $data.Range.From, datepickerOptions: { dateFormat: $root.jQformatDate($data.Format) }, style: { 'opacity': $parent.multiSearchOn() ? '0.3' : '1' }" data-tabgroup="itemlistfilter" data-tabgroupindex="7">