It seems like website was updated and they did some minor changes but I can not figure out what I need to correct... if anybody could help?
Example:
Search on Military Database for serial 80-0223 was automatically input in Excel's fields ic. Serial. Code, Type, CN etc. ,
right now I am not getting any errors but no data is retrieved
Example:
Search on Military Database for serial 80-0223 was automatically input in Excel's fields ic. Serial. Code, Type, CN etc. ,
right now I am not getting any errors but no data is retrieved
VBA Code:
Dim cel As Range, ms As Worksheet, dom As HTMLDocument, loopRange As Range
Const SEARCH_URL As String = "https://www.scramble.nl/index.php?option=com_mildb&view=search"
' USAF --------------------------------------------------------------------------------------------------------------------------
Set ms = ThisWorkbook.Worksheets("Scramble")
Set dom = New HTMLDocument
Set loopRange = ms.Range("B2:B" & ms.Range("B" & Rows.Count).End(xlUp).row).SpecialCells(2)
Application.ScreenUpdating = False
With CreateObject("winhttp.winhttprequest.5.1")
For Each cel In loopRange
.Open "POST", SEARCH_URL, False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.send "Itemid=60&af=usaf&serial=" & cel & "&sbm=Search&code=&searchtype=&unit=&cn="
dom.body.innerHTML = .responseText
Dim recordFields As Object
Set recordFields = dom.querySelectorAll(".rowBord td")
If recordFields.Length > 0 Then
With cel
.Offset(, -1) = recordFields.Item(2).innerText 'Type
.Offset(, 2) = recordFields.Item(1).innerText 'Code
.Offset(, 3) = recordFields.Item(4).innerText 'Unit
.Offset(, 10) = recordFields.Item(3).innerText 'C/N
.Offset(, 11) = recordFields.Item(5).innerText 'Status
.Offset(, 7) = "USAF"
End With
End If
Next
End With
Application.ScreenUpdating = True