|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 VBA万岁 于 2014-10-10 09:10 编辑
liucqa 发表于 2014-10-9 20:06
Sub figjson4()
Dim aa, x, s, y
aa = "{ ""people"": [{ ""firstName"": ""Brett"", ""lastNa ...
38楼HHAAMM版主说过,javascript好像是区分大小写的,将aa中的emai改为Emai(或者同改为首字母小字如34楼)就可以了。
Sub figjson4()
Dim aa, x, s, y
aa = "{ ""people"": [{ ""firstName"": ""Brett"", ""lastName"":""McLaughlin"", ""Emai"": ""brett@newInstance.com"" },{ ""firstName"": ""Jason"", ""lastName"":""Hunter"", ""Email"": ""jason@servlets.com"" }, { ""firstName"": ""Elliotte"", ""lastName"":""Harold"", ""Email"": ""elharo@macfaq.com"" }]}"
Set x = CreateObject("ScriptControl")
x.Language = "JScript"
s = "function j(s) { return eval('(' + s + ').people[1]'); }"
x.AddCode s
Set y = x.Run("j", aa)
MsgBox y.firstName
MsgBox y.Email
End Sub
|
|