hỏi cách lấy dữ liệu từ bảng giá chứng khoán trực tuyến trên web vào file excel

Liên hệ QC
trong file có cái nút bấm , tùy chọn sàn mà lấy nhé

Mã:
Public Sub hello(ByVal region As String, ByVal targetTB As String)
Dim arr(1 To 2000, 1 To 25), r As Long, str As String
Dim mats, mapID, mat, dArr, ub As Long, col As Long
With CreateObject("MSXML2.ServerXMLHTTP")
    .Open "GET", "http://priceboard.fpts.com.vn/" & region & "/data.ashx?s=quote&l=" & targetTB, False
    .send
    str = .ResponseText
End With
mapID = Array(1, 2, 3, 4, -1, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, _
        16, 17, 18, 19, -1, 20, 21, 22, 23, -1, 24, 25)
ub = UBound(mapID) + 1
With CreateObject("VBScript.RegExp")
    .Global = True
    .Pattern = "\[""?(\d{1,2})""?,""?([^\]""]+)""?"
    dArr = Split(str, "}")
    For r = 0 To UBound(dArr)
        Set mats = .Execute(dArr(r))
        For Each mat In mats
            col = mat.submatches(0)
            If col < ub Then
                If mapID(col) > 0 Then
                    arr(r + 1, mapID(col)) = mat.submatches(1)
                End If
            End If
        Next
    Next
End With
Sheet1.Range("A5").Resize(UBound(arr), UBound(arr, 2)).Value = arr
End Sub
Bạn có thể giúp mình chút được không vậy. Mình muốn lấy dữ liệu về excel để quản lý nó mà loay hoay mãi không biết sao. Loanh quanh Data from Web mãi mà ko đc ? Có thể zalo giúp mình với được ko vậy 0988 51 9889. Cám ơn bạn nhiều !
 
Web KT
Back
Top Bottom