Dear Professionals
I have been using the following macro script to download data from a website to a newly create Excel file named "seed"
It works well for months but suddenly fail today. Can you assist to fix the bug please? Many thanks in advance
Sub Seed()
Const URL$ = "http://webb-site.com/dbpub/": Dim SP$()
With CreateObject("Microsoft.XMLHttp")
.Open "GET", URL & "orgdata.asp?code=" & Sheets(1).Cells(1, 1).Text & "&Submit=Current", False
.setRequestHeader "DNT", "1"
On Error Resume Next
.send
On Error GoTo 0
If .Status <> 200 Then Beep: Exit Sub
SP = Split(.responseText, "'>Raw prices<"): If UBound(SP) < 1 Then Beep: Exit Sub
End With
SP = Split(SP(0), "'")
With Workbooks.Add.Worksheets(1)
With .QueryTables.Add("URL;" & URL & SP(UBound(SP)), .Cells(1))
.AdjustColumnWidth = False: .WebFormatting = xlWebFormattingNone
.WebSelectionType = xlSpecifiedTables: .WebTables = "4"
.Refresh False: .Delete
End With
Application.DisplayAlerts = False
.Parent.Close True, ThisWorkbook.Path & "\seed"
Application.DisplayAlerts = True
End With
End Sub
Bookmarks