'Scraping data from a dictionary using vba
I am trying to scrape some data from a dictionary with a condition and print the result data to my excel document.
The Website: https://tureng.com/tr/turkce-ingilizce
Excel Document Sample
The code needs to take the data from column (A) and print it to the searchbar on the website. Then it needs to click enter and take the translated data whose type matches the column (E) which is in my document. For example: adjective means "s." on the website. So the code should take the first word that has "s." for the example word "all right"
As a result of my tryings, I came to this stage, but I do not know how to pull data of class type depending on the condition. Can you guys please help me?
Const URLstr As String = "https://tureng.com/tr/turkce-ingilizce/seal"
Private Sub CommandButton1_Click()
Dim objIE As SHDocVw.InternetExplorer
Dim ieDoc As MSHTML.HTMLDocument
Dim searchfield As MSHTML.HTMLInputElement
Dim searchbutton As MSHTML.HTMLInputElement
Dim result As MSHTML.HTMLInputElement
Dim i As Integer
Set objIE = New SHDocVw.InternetExplorer
objIE.Navigate URLstr
Do Until objIE.readyState = READYSTATE_COMPLETE: Loop
Set ieDoc = objIE.document
objIE.Visible = True
For i = 2 To 94
Set searchfield = ieDoc.all.Item("searchTerm")
Application.Wait Now() + #12:00:01 AM#
searchfield.Value = Cells(i, 1)
searchfield.Select
Application.SendKeys "~"
Application.Wait Now() + #12:00:01 AM#
Set result = ieDoc.all.Item("tr ts")(0)
Cells(i, 2) = result.innerText
Next i
objIE.Quit
End Sub
html code of the website
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


