Extract Data from Web (URL)
Here is a small piece of code to extract data from a web page. Pass the url and target range to the below function.
Sub ExtractUrl(strURL As String, rngTarget As Range) Dim wksCurrent As Worksheet Set wksCurrent = ActiveSheet With CreateObject("InternetExplorer.Application") '.Visible = True Application.StatusBar = "Extracting from: " & strURL .Navigate strURL 'Set wait time to allow the url to load completely Call Application.Wait(Now + TimeValue("0:00:05")) Do Until .ReadyState = 4: DoEvents: Loop Application.Goto rngTarget .ExecWB 17, 2 '// SelectAll .ExecWB 12, 0 '// Copy selection rngTarget.Parent.Paste .Quit End With Application.StatusBar = False wksCurrent.Activate Set wksCurrent = Nothing End Sub
»
- Vishesh's blog
- Login or register to post comments
- 6065 reads
Recent comments
5 years 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago