一. 这种方式比较复杂,因为office版本的原因,所以要加其它函数

 Private Function parseScript(strJson As String)

 Dim objJson As Object
'With CreateObject("msscriptcontrol.scriptcontrol") '在64位office里可能无法创建此对象,所以使用x86的方法
With CreateObjectx86("msscriptcontrol.scriptcontrol") .Language = "javascript"
.addcode "var mydata =" & strJson
Set objJson = .codeobject
End With
Set parseScript = objJson End Function Function parseJson() Dim objJson As Object
Set objJson = parseScript("[{""name"":""choco"",""age"":21},{""name"":""anne"",""age"":27}],{""name"":""heming"",""age"":44}]") Dim objItem
For Each objItem In objJson.mydata
Debug.Print CallByName(objItem, "name", VbGet)
Debug.Print CallByName(objItem, "age", VbGet)
Next End Function Function CreateObjectx86(Optional sProgID, Optional bClose = False)
Static oWnd As Object
Dim bRunning As Boolean
#If Win64 Then
bRunning = InStr(TypeName(oWnd), "HTMLWindow") >
If bClose Then
If bRunning Then oWnd.Close
Exit Function
End If
If Not bRunning Then
Set oWnd = CreateWindow()
oWnd.execScript "Function CreateObjectx86(sProgID): Set CreateObjectx86 = CreateObject(sProgID): End Function", "VBScript"
End If
Set CreateObjectx86 = oWnd.CreateObjectx86(sProgID)
#Else
Set CreateObjectx86 = CreateObject("MSScriptControl.ScriptControl")
#End If
End Function Function CreateWindow()
Dim sSignature, oShellWnd, oProc
On Error Resume Next
sSignature = Left(CreateObject("Scriptlet.TypeLib").GUID, )
CreateObject("WScript.Shell").Run "%systemroot%\syswow64\mshta.exe about:""about:<head><script>moveTo(-32000,-32000);document.title='x86Host'</script><hta:application showintaskbar=no /><object id='shell' classid='clsid:8856F961-340A-11D0-A96B-00C04FD705A2'><param name=RegisterAsBrowser value=1></object><script>shell.putproperty('" & sSignature & "',document.parentWindow);</script></head>""", , False
Do
For Each oShellWnd In CreateObject("Shell.Application").Windows
Set CreateWindow = oShellWnd.GetProperty(sSignature)
If Err.Number = Then Exit Function
Err.Clear
Next
Loop
End Function

Json解析方式汇总 excel vba的更多相关文章

  1. XML解析方式汇总

    XML解析方式汇总 分类: XML2011-08-23 19:19 167人阅读 评论(0) 收藏 举报 xmlstringexceptionattributesclassiterator DOM解析 ...

  2. JAVA中的四种JSON解析方式详解

    JAVA中的四种JSON解析方式详解 我们在日常开发中少不了和JSON数据打交道,那么我们来看看JAVA中常用的JSON解析方式. 1.JSON官方 脱离框架使用 2.GSON 3.FastJSON ...

  3. 复杂json解析方式[GsonFormat]

    针对开发人员来讲,善于用工具,事半功倍. 干货: 1.IntelliJ IDEA 通过GsonFormat插件将JSONObject格式的String 解析成实体 插件地址:https://plugi ...

  4. Json解析方式

    http://blog.sina.com.cn/s/blog_628cc2b70101dydc.html

  5. Json解析工具Jackson(简单应用)

    原文http://blog.csdn.net/nomousewch/article/details/8955796 概述 Jackson库(http://jackson.codehaus.org),是 ...

  6. C#调用Excel VBA宏

    近日的一系列工作是做网站的营运维护,因此做了大量的支持工具.有Excel中写VBA的,也有直接C#做的工具.有时需要在C#中执行Excel VBA宏,甚至有时还需要在执行了VBA宏之后,获取返回值再进 ...

  7. 【代码笔记】iOS-json文件的两种解析方式

    一,工程图. 二,代码. #import "ViewController.h" #import "SBJson.h" @interface ViewContro ...

  8. C#调用Excel VBA宏[转载]

    原文地址:https://www.cnblogs.com/heekui/archive/2008/03/30/1129355.html 近日的一系列工作是做网站的营运维护,因此做了大量的支持工具.有E ...

  9. iOS - 分析JSON、XML的区别和解析方式的底层是如何实现的(延伸实现原理)

    <分析JSON.XML的区别,JSON.XML解析方式的底层是如何实现的(延伸实现原理)> (一)JSON与XML的区别: (1)可读性方面:基本相同,XML的可读性比较好: (2)可扩展 ...

随机推荐

  1. 十进制转换为其他进制(不使用format)

    base = [str(x) for x in range(10)] + [chr(x) for x in range(ord('A'), ord('A') + 6)] # ['0', '1', '2 ...

  2. JS中Math.random()的使用和扩展

    Math.random()方法返回大于等于 0 小于 1 的一个随机数.对于某些站点来说,这个方法非常实用,因为可以利用它来随机显示一些名人名言和新闻事件. 在连续整数中取得一个随机数 值 = Mat ...

  3. PHP ftp_ssl_connect() 函数

    定义和用法 ftp_ssl_connect() 函数打开一个安全的 SSL-FTP 连接. 当连接打开,您就可以在服务器运行 FTP 函数. 语法 ftp_ssl_connect(host,port, ...

  4. ORACLE不完成恢复ORA-00392,ORA-00312,ORA-00349

    背景: 进行测试库不完全恢复,log_file_name_convert没调整好.rac-asm至单实例-文件系统,recover完成后,mount状态的database  执行 alter data ...

  5. [转] 9种设计模式在Spring中的运用

    作者:iCoding91地址:https://blog.csdn.net/caoxiaohong1005 转发的公众号地址,有其他设计模式介绍:https://mp.weixin.qq.com/s/Z ...

  6. LeetCode 164. Maximum Gap[翻译]

    164. Maximum Gap 164. 最大间隔 Given an unsorted array, find the maximum difference between the successi ...

  7. 一文打尽Java抽象类和接口的相关问题

    相关文章: <面向对象再探究>:介绍了面向对象的基本概念 <详解Java的对象创建>:介绍了对象的创建.构造器的使用 <一文打尽Java继承的相关问题>:介绍了继承 ...

  8. 025_go语言中的通道同步

    代码演示 package main import "fmt" import "time" func worker(done chan bool) { fmt.P ...

  9. 论文结果图:matplotlib和seaborn实现

    在论文中,可视化结果往往很重要,毕竟文字太抽象,需要图片向审稿人直观的展现出我们的结果.我也写了俩篇论文和一篇专利的申请,其中也有一些画图的程序,因此记录,防止以后忘了.由于篇幅原因,文章就不贴代码, ...

  10. 关于Springboot配置文件的理解

    一.Springboot Springboot是用来简化Spring框架搭建和开发一款框架,可以理解为是一种Spring框架的简化版. 二.如何在IDEA里面初始化Springboot 主要可以分为两 ...