Hi - Any help on the below issues would be greatly appreciated.
Using VBA I am trying to input a field (serial number e.g. PC0X5YHZ) into a web page and then extract data...
https://pcsupport.lenovo.com/us/en/...nty and Repair:Warranty|Check Warranty Status
Problem one: I can insert the serial into the text field but can't seem to find a way to code for pressing the Check Warranty button (can't get 'click' or sending enter to work) and when I do manage to insert and manually press, the field just blanks and nothing is found.
Problem two: Once in the page I am trying to extract 3 fields:
Machine Type Model: = 20KES5SD09
Expiration Date: = 2021-08-23
Start Date: = 2018-08-24 (need to press the down arrow tag on right side to drop down further field info which contains this item)
Have managed the first two but can't seem to extract the date from the for Start Date.
My code so far (I have named my ranges and enabled the relevant references):
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = Range("Serial_Number").Row And Target.Column = Range("Serial_Number").Column Then
Dim IE As New InternetExplorer
'IE.Visible = True
IE.navigate "https://pcsupport.lenovo.com/gb/en/products/laptops-and-netbooks/thinkpad-x-series-laptops/thinkpad-x280-type-20kf-20ke/20ke/20kes5sd09/pc0x5yhz/warranty" ' I am using this hard coded line as can't manage to code pressing check warranty button - this bypasses that need but no good for multiple serials
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Dim Doc As HTMLDocument
Set Doc = IE.document
Dim Class As String
Class = Trim(Doc.getElementsByClassName("mt-code")(0).innerText)
Range("Model_Number").Value = Class
Dim Expiration As Date
Expriation = Trim(Doc.getElementsByClassName("expirationDate")(0).innerText)
Range("End_Date").Value = Expriation
Dim Start As Date
Start = Trim(Doc.getElementsByClassName("daysTips")(0)(span,0)(2).innerText) 'The bold text errors. There are multiple text elements to the span & I don't know how to extract.
Range("Start_Date").Value = Start
IE.Quit
End If
End Sub
Using VBA I am trying to input a field (serial number e.g. PC0X5YHZ) into a web page and then extract data...
https://pcsupport.lenovo.com/us/en/...nty and Repair:Warranty|Check Warranty Status
Problem one: I can insert the serial into the text field but can't seem to find a way to code for pressing the Check Warranty button (can't get 'click' or sending enter to work) and when I do manage to insert and manually press, the field just blanks and nothing is found.
Problem two: Once in the page I am trying to extract 3 fields:
Machine Type Model: = 20KES5SD09
Expiration Date: = 2021-08-23
Start Date: = 2018-08-24 (need to press the down arrow tag on right side to drop down further field info which contains this item)
Have managed the first two but can't seem to extract the date from the for Start Date.
My code so far (I have named my ranges and enabled the relevant references):
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = Range("Serial_Number").Row And Target.Column = Range("Serial_Number").Column Then
Dim IE As New InternetExplorer
'IE.Visible = True
IE.navigate "https://pcsupport.lenovo.com/gb/en/products/laptops-and-netbooks/thinkpad-x-series-laptops/thinkpad-x280-type-20kf-20ke/20ke/20kes5sd09/pc0x5yhz/warranty" ' I am using this hard coded line as can't manage to code pressing check warranty button - this bypasses that need but no good for multiple serials
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Dim Doc As HTMLDocument
Set Doc = IE.document
Dim Class As String
Class = Trim(Doc.getElementsByClassName("mt-code")(0).innerText)
Range("Model_Number").Value = Class
Dim Expiration As Date
Expriation = Trim(Doc.getElementsByClassName("expirationDate")(0).innerText)
Range("End_Date").Value = Expriation
Dim Start As Date
Start = Trim(Doc.getElementsByClassName("daysTips")(0)(span,0)(2).innerText) 'The bold text errors. There are multiple text elements to the span & I don't know how to extract.
Range("Start_Date").Value = Start
IE.Quit
End If
End Sub