Scrape JSON data from multiple urls using Multi-Threading

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

i am pulling data using QueryTables method.. but its very slow.. how to replace it with multithreading method in Excel VBA ??

could you help me tweak my code:

Dim v
v = Array(Sheet3.Cells(1, 1), Sheet3.Cells(2, 1), Sheet3.Cells(3, 1), Sheet3.Cells(4, 1), Sheet3.Cells(5, 1))

For i = 0 To 4
With MyBook.Sheets("Sheet1").QueryTables.Add(Connection:="URL;" & v(i), Destination:=MyBook.Sheets("Sheet1").Cells(2, (i + 1))
Sheet1.Refresh BackgroundQuery:=False
End With
Next i

edited answer

Hi Bhushan Shah,

you can’t do this via the VBA Multithreading Tool as this exploits QueryTables not VBA Procedures. I would encourage you to convert the Query to an entire VBA procedure first. You can find couple examples in my VBA Web Scraping Kit.

Then I would encourage the use of the free VBA Multithreading Tool to run the JSON queries in parallel

edited answer

Simply the best place to learn Excel VBA