能不能把
http://money.finance.sina.com.cn/corp/view/vFD_FinanceSummaryHistory.php?stockid=600001&type=hbzj
这个网页中的
2009-03-31 1,777,965,101.220
这两个数据提取出来,存入数据库里面啊。
请各位指教!
http://money.finance.sina.com.cn/corp/view/vFD_FinanceSummaryHistory.php?stockid=600001&type=hbzj
这个网页中的
2009-03-31 1,777,965,101.220
这两个数据提取出来,存入数据库里面啊。
请各位指教!
Set doc = WebBrowser1.Document
Dim table As HTMLTable
Set table = doc.getElementById("table1")
Dim row As HTMLTableRow
Dim cell As HTMLTableCell
Set row = table.rows.Item(1)
Set cell = row.cells(1)
Debug.Print cell.innerText
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) http://feiyun0112.cnblogs.com/
Dim strTemp As String
strTemp = RichTextBox1
Call sub_GetData(strTemp, "货币资金", Text1)
Call sub_GetData(strTemp, "短期投资净额", Text2)End SubPrivate Sub sub_GetData(ByVal strSource As String, ByVal strRefer As String, objTextBox As TextBox)
Dim lngStrtT As Long
Dim lngStart As Long
Dim lngEnd As Long
lngStartT = InStr(1, strSource, strRefer) + Len(strRefer)
lngStart = InStr(lngStartT, strSource, "<TD>") + Len("<TD>")
lngEnd = InStr(lngStart, strSource, "</TD>") - 1
objTextBox = Trim(Mid(strSource, lngStart, lngEnd - lngStart + 1))
End Sub
Dim strTemp As String
strTemp = RichTextBox1
Call sub_GetData(strTemp, "货币资金", Text1)
Call sub_GetData(strTemp, "短期投资净额", Text2)End SubPrivate Sub sub_GetData(ByVal strSource As String, ByVal strRefer As String, objTextBox As TextBox)
Dim lngStrtT As Long
Dim lngStart As Long
Dim lngEnd As Long
lngStartT = InStr(1, strSource, strRefer) + Len(strRefer)
lngStart = InStr(lngStartT, strSource, "<TD>") + Len("<TD>")
lngEnd = InStr(lngStart, strSource, "</TD>") - 1
objTextBox = Trim(Mid(strSource, lngStart, lngEnd - lngStart + 1))
End Sub
Private Sub Form_Load()
Dim x As New XMLHTTP
Dim s$
x.open "post", "http://money.finance.sina.com.cn/corp/view/vFD_FinanceSummaryHistory.php?stockid=600001&type=hbzj", False
x.setRequestHeader "charset", "UTF-8"
x.send (Null)
s = x.responseText
Set x = Nothing
Dim re As New RegExp
re.Global = True
re.IgnoreCase = True
re.MultiLine = True
re.Pattern = "(<td style=""text-align:center"">)(.*)(</td>)"
Dim ma As MatchCollection, m As Match, i%
Dim aa$, k%
k = -1
Set ma = re.Execute(s)
For i = 0 To ma.Count - 1
Set m = ma(i)
aa = re.Replace(m.Value, "$2")
If aa = "2009-03-31" Then
Text1 = aa: k = i + 1
ElseIf i = k Then
Text2 = aa: Exit For
End If
Next
Set m = Nothing
Set ma = Nothing
Set x = Nothing
End Sub
Set ma = Nothing
Set x = Nothing
-------->
Set m = Nothing
Set ma = Nothing
Set re= Nothing界面上放两个文本框
<tr><td width='150px'><strong>报告期</strong></td><td>2009-06-30</td><td>2009-03-31</td><td>2008-12-31</td><td>2008-09-30</td></tr><tr><td colspan='5'><strong>资产</strong></td></tr><tr><td colspan='5'><strong>流动资产</strong></td></tr><tr><td width='150px'><a target='_blank' href='/corp/view/vFD_FinanceSummaryHistory.php?stockid=600827&type=hbzj'>货币资金</a></td><td>7,107,315,888</td><td>7,461,738,198</td><td>7,102,736,371</td><td>6,074,186,310</td></tr><tr><td width='150px'><a target='_blank' href='/corp/view/vFD_FinanceSummaryHistory.php?stockid=600827&type=dqtz'>
网页源文件在这,怎么提取我标注的数字,请教