Hello kboy1289,
Here is faster an easier way to it.
Sub ImportCSVFromWeb(ByVal URL As String)
' Summary: Imports a CSV file from the web to tthe active worksheet.
' Written: December 16, 2013
' Author: Leith Ross
Dim i As Long
Dim n As Long
Dim r As Long
Dim Text As String
Dim TextLine As String
Dim TextArray As Variant
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", URL, True
.send
While .readyState <> 4: DoEvents: Wend
Text = .responsetext
End With
Text = GetServerResponse(URL)
Do
i = n + 1
n = InStr(i, Text, Chr(10))
If n = 0 Then Exit Do
TextLine = Mid(Text, i, n - i)
If InStr(1, TextLine, ",") Then
TextArray = Split(TextLine, ",")
Range("A1").Offset(r, 0).Resize(1, UBound(TextArray)).Value = TextArray
Else
Range("A1").Offset(r, 0).Value = TextLine
End If
r = r + 1
Loop
End Sub
Sub GetYieldTable()
Call ImportCSVFromWeb("http://www.ffiec.gov/ratespread/YieldTableFixed.CSV")
End Sub
Bookmarks