|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
以下是网上找到的代码,是新浪上下载十大流通股东的,我自己的vb学的太次了,哪位大神帮忙转成vba能执行的?
Public Function GetShiDaLiuTong(code As String) As Dictionary(Of String, List(Of GuDong))
Dim result As Dictionary(Of String, List(Of GuDong))
Try
Dim xinLangWebContent As String = GetXinLangWebContent(String.Format("http://vip.stock.finance.sina.com.cn/corp/go.php/vCI_CirculateStockHolder/stockid/{0}.phtml", code))
Dim array As String() = Regex.Split(xinLangWebContent, ChrW(25130) & ChrW(27490) & ChrW(26085) & ChrW(26399))
Dim dictionary As Dictionary(Of String, List(Of GuDong)) = New Dictionary(Of String, List(Of GuDong))()
For i As Integer = 2 To array.Length - 1
Dim strShiDa As String = array(i)
Dim empty As String = String.Empty
Dim eachShiDa As List(Of GuDong) = Me.GetEachShiDa(strShiDa, code, empty)
dictionary(empty) = eachShiDa
Next
result = dictionary
Catch ex_64 As Object
File.AppendAllText("TestShiDaLiuTongDebug", String.Format("{0}" & ChrW(30340) & ChrW(21313) & ChrW(22823) & ChrW(27969) & ChrW(36890) & ChrW(32929) & ChrW(19996) & ChrW(21457) & ChrW(29983) & ChrW(24322) & ChrW(24120), code))
result = New Dictionary(Of String, List(Of GuDong))()
End Try
Return result
End Function
Public Shared Function GetXinLangWebContent(http As String) As String
Dim result As String
Try
Dim text As String = ""
Dim array As Char() = New Char(256)
Dim requestUri As Uri = New Uri(http)
Dim httpWebRequest As HttpWebRequest = CType(WebRequest.Create(requestUri), HttpWebRequest)
Dim httpWebResponse As HttpWebResponse = CType(httpWebRequest.GetResponse(), HttpWebResponse)
Dim responseStream As Stream = httpWebResponse.GetResponseStream()
Dim streamReader As StreamReader = New StreamReader(responseStream, Encoding.[Default])
For num As Integer = streamReader.Read(array, 0, 256)To
Dim str As String = New String(array, 0, num)
text += str
Next
responseStream.Close()
result = text
Catch ex_9D As Object
result = String.Empty
End Try
Return result
End Function
|
|