So I am navigating a website, I've come across a situation where there could be multiple textboxes on the page. So I have a loop that is going to determine all the values of the "input" tags on the page. I want to only change the input boxes that have todays date in them.
Code:
futuredate = Format(Date + 7, "m/d/yyyy")
Cnt = 0
With oie.document.all
For Each oCell In .tags("input")
If oCell.value = "3/7/2016" Then
oCell.value = futuredate
End If
Cnt = Cnt + 1
Debug.Print oCell.value & "- Cnt is " & Cnt
Next oCell
End With
Set oCell = Nothing
And this works fine, makes the changes without any issues. Now, when I try to replace the hardcoded date with Date, the code never picks it up in the if statement, even though ocell.value and date are both identical in the immediate window.
Code:
futuredate = Format(Date + 7, "m/d/yyyy")
Cnt = 0
With oie.document.all
For Each oCell In .tags("input")
If oCell.value = Date Then ' This is a true statement, even the formatting is the same. Why doesn't it work?
oCell.value = futuredate
End If
Cnt = Cnt + 1
Debug.Print oCell.value & "- Cnt is " & Cnt
Next oCell
End With
Set oCell = Nothing
Any advice? Kind of stumped on this one.