|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub Test()
- Dim arr As Variant, lngRow As Long
- Dim strJson As String
-
- arr = Sheet1.Range("A2:B3")
-
- For lngRow = LBound(arr) To UBound(arr)
- strJson = arr(lngRow, 1)
- arr(lngRow, 2) = GetJson(strJson)
- Next
-
- Sheet1.Range("A2:B3") = arr
- End Sub
- Function GetJson(strJson As String) As String
-
- Dim objHTML As Object, objWin As Object
- Dim lngCount As Long, lngID As Long, strResult As String
-
- Set objHTML = CreateObject("htmlfile")
- Set objWin = objHTML.parentWindow
-
- objWin.execScript "var json = " & strJson, "JScript"
-
- lngCount = objWin.eval("json.length")
- For lngID = 0 To lngCount - 1
- strResult = strResult & " " & objWin.eval("json[" & lngID & "].text")
- Next
- GetJson = strResult
- End Function
复制代码 |
评分
-
2
查看全部评分
-
|