|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
给你方法,自己处理
- Sub Test()
- MsgBox GetVal("https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=flexible+strip+light")
- End Sub
- Function GetVal(strUrl As String) As String
- Dim strResult As String, strSplit() As String
- With CreateObject("msxml2.xmlhttp")
- .Open "GET", strUrl, False
- .send
- strResult = StrConv(.responseBody, vbUnicode, &H804)
- End With
-
- If strResult = "" Then Exit Function
- strSplit = Split(strResult, "s-result-count")
- If UBound(strSplit) < 1 Then Exit Function
-
- strResult = strSplit(1)
- strSplit = Split(strResult, "over")
- If UBound(strSplit) < 1 Then Exit Function
-
- strResult = strSplit(1)
- strSplit = Split(strResult, "results")
- strResult = strSplit(0)
- GetVal = strResult
- End Function
复制代码 |
|