ExcelRooky91
New Member
- Joined
- Apr 3, 2018
- Messages
- 10
Hi All,
I'm grinding away at my first attempt at writing a code and I'm struggling with trying to input a date in a search field box. My current code results in runtime error 13: Type mismatch.
Anyone more experienced able to shed some light for me?
Kind regards,
Ty
The Website I'm accessing is: https://www.nzfma.org/data/search.aspx
My current code is:
I'm grinding away at my first attempt at writing a code and I'm struggling with trying to input a date in a search field box. My current code results in runtime error 13: Type mismatch.
Anyone more experienced able to shed some light for me?
Kind regards,
Ty
The Website I'm accessing is: https://www.nzfma.org/data/search.aspx
My current code is:
Code:
Sub BKBM_Rates()
'This will load a webpage in IE
Dim i As Long
Dim URL As String
Dim IE As Object
Dim objElement As Object
Dim objCollection As Object
'Create InternetExplorer Object
Set IE = CreateObject("InternetExplorer.Application")
'Set IE.Visible = True to make IE visible, or False for IE to run in the background
IE.Visible = True
'Define URL
URL = "[URL]https://www.nzfma.org/data/search.aspx[/URL]"
'Navigate to URL
IE.Navigate URL
'make sure the page is done loading
Do
DoEvents
Loop Until IE.ReadyState = 4
'attempting to search date based on date value in cell
Dim inputfield As HTMLInputElement
Set inputElement = IE.document.getElementById("ct100_cphBody_rdpDate_dateInput")
If inputfield.Type = "text" Then inputfield.Value = Sheets("Sheet1").Range("b2").Value
'clicking the search button
IE.document.getElementById("cphBody_btnSearch").Click
End Sub