Reputation: 23
I'm getting an error showing type mismatch when i use the following code to enter the date
Dim HTMLInp As MSHTML.IHTMLElement
Set HTMLInp = HTMLDoc.getElementsById("startDate")
HTMLInp.Value = Worksheets("Menu").Range("a3")
Upvotes: 2
Views: 820
Reputation: 433
Have you tried setting the value
HTMLDoc.getElementsByClassName("dropdown-menu").value = "YourDesiredValue"
or the selected index
HTMLDoc.getElementsByClassName("dropdown-menu").selectedIndex = 1
Also try some of this:
With .FindElementByCss("[data-test='date-picker-full-range']")
.ScrollIntoView
.Click
End With
With .FindElementByCss("[name=startDate]")
.Clear
.SendKeys "05/10/2017"
End With
With .FindElementByCss("[name=endDate]")
.Clear
.SendKeys "05/10/2017"
End With
another source for info: https://web.archive.org/web/20170802065959/www.vb-tips.com/MSHTML.aspx
Upvotes: 0
Reputation: 84465
It is
HTMLDoc.getElementById("startDate")
The retrieval method is to return a single element without the s
.
Upvotes: 1