VBA从集合中获取值? [英] VBA getting values from a collection?

查看:24
本文介绍了VBA从集合中获取值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 VBA 很陌生,我不知道如何从集合中获取值.

I am very new to VBA and I can not figure out how to get values from a Collection.

这是我的代码:

Dim p As Object
Set p = JSON.parse(Response.Content)

Dim links As Object
Set links = p.Item("links")

在链接"的调试器中我看到:

In the debugger for "links" I see:

我正在使用这个库来解析 json:http://www.ediy.co.nz/vbjson-json-parser-library-in-vb6-xidc55680.html

I am using this library to parse json : http://www.ediy.co.nz/vbjson-json-parser-library-in-vb6-xidc55680.html

我在json中的部分是:

The part I have in json is:

"links":[
    {
        "rel":"next",
        "href":"www.google.com"
    }
]

这里如何获取rel"的值?

How can I get the value of "rel" here?

推荐答案

别忘了 bang 运算符,专为按键访问集合而设计:

Don't forget the bang operator, designed for collection access by key:

links(1)!rel

或:

links(1)![rel] 'When there are spaces or reserved words.

这篇关于VBA从集合中获取值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆