New Member
November 27, 2021
Dear All,
I need help to figure out how to scrape data from the below website that needs login to show the data. And I want to output this data on excel using VBA.
The above is the website page and I want to extract the "draught" form it.
The below is another website that I use that doesn't need login and below it is the code I use.
Sub test()
Dim request As Object
Dim response As String
Dim html As New HTMLDocument
Dim website As Variant
Dim price As Variant
Dim var As Variant
Dim var2 As Variant
Dim result() As String
' On Error Resume Next
web = "https://www.vesselfinder.com/vessels/"
For I = 2 To 2
var = Sheets("SHIP_NAME").Cells(I, 2).Value
website = web & var
' Create the object that will make the webpage request.
Set request = CreateObject("MSXML2.XMLHTTP")
' Where to go and how to go there - probably don't need to change this.
request.Open "GET", website, False
' Get fresh data.
request.setRequestHeader "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"
' Send the request for the webpage.
request.send
' Get the webpage response data into a variable.
response = StrConv(request.responseBody, vbUnicode)
' Put the webpage into an html object to make data references easier.
html.body.innerHTML = response
' Get the price from the specified element on the page.
price = html.getElementsByClassName("v3").Item(3).innerText
' Output the price into a cell.
Sheets("Sheet1").Cells(I, 4).Value = price
Next I
End Sub
Can anyone suggest the code that I can use to extract draught from fleetmon website ?
Thank you in advance and best regards,
Joe El Hage
00306909065723
1 Guest(s)