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
- 6090 reads
Recent comments
5 years 42 weeks ago
6 years 28 weeks ago
6 years 40 weeks ago
6 years 43 weeks ago
6 years 44 weeks ago
6 years 49 weeks ago
7 years 5 weeks ago
7 years 6 weeks ago
7 years 6 weeks ago
7 years 6 weeks ago