|
- 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
- Sub Test()
- Dim strJson As String
-
- strJson = Sheet1.Range("A3").Value
-
- MsgBox GetJson(strJson)
- End Sub
复制代码 |
|