I am trying to write a code to open internet explorer, go to the MOT checking website and run a check on a registration number. I then want it to put the date the MOT expires into my sheet. I would ideally like it to pick the registration from the sheet in say cell A2 and place the result alongside it in B2 but I haven't managed to work that bit out yet so the registration is currently listed in the code.
The issue I am having is the element name in the developer tools changes each time internet explorer opens. Is there a way that I can get the element name as part of the process once IE opens?
The code on the DOM Explorer is:
The code I currently have is below. I am hoping that I can select the MOT expiry in a similar way to how I would enter the registration:
Thanks in advance.
The issue I am having is the element name in the developer tools changes each time internet explorer opens. Is there a way that I can get the element name as part of the process once IE opens?
The code on the DOM Explorer is:
CSS:
input name="320320320b260e2c6c2df0a7daf5c24b203c6d3f1609806998" class="form-control" id="320320320b260e2c6c2df0a7daf5c24b203c6d3f1609806998" type="text" value=""
The code I currently have is below. I am hoping that I can select the MOT expiry in a similar way to how I would enter the registration:
Code:
Option Explicit
Sub ie_automated()
Dim IE As InternetExplorer
Dim sURL As String
sURL = "www.check-mot.service.gov.uk"
Set IE = New InternetExplorer
With IE
.AddressBar = 0
.StatusBar = 0
.Toolbar = 0
.Visible = True
.Navigate sURL
Do Until Not .Busy And .ReadyState = 4
DoEvents
Loop
.Document.all("???").Value = "YB62XDY"
Application.Wait Now + TimeSerial(0, 0, 2)
End With
Do Until Not IE.Busy
DoEvents
Loop
IE.Document.all("submit").Click
End Sub
Thanks in advance.