Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 使用MSXML2.XMLHTTP从网页提取JSON值_Vba_Ms Access - Fatal编程技术网

Vba 使用MSXML2.XMLHTTP从网页提取JSON值

Vba 使用MSXML2.XMLHTTP从网页提取JSON值,vba,ms-access,Vba,Ms Access,目前我能够从网页中提取值,但面临json值提取问题 On Error Resume Next Set http = CreateObject("MSXML2.XMLHTTP") http.Open "GET", url1234, False http.Send html.body.innerHTML = http.ResponseText brand = html.body.innerText 'MsgBox (brand) 我使用以下代码提取其他值

目前我能够从网页中提取值,但面临json值提取问题

On Error Resume Next
Set http = CreateObject("MSXML2.XMLHTTP")
    http.Open "GET", url1234, False
    http.Send
    html.body.innerHTML = http.ResponseText
    brand = html.body.innerText
    'MsgBox (brand)

我使用以下代码提取其他值

On Error Resume Next
Set http = CreateObject("MSXML2.XMLHTTP")
    http.Open "GET", url1234, False
    http.Send
    html.body.innerHTML = http.ResponseText
    brand = html.body.innerText
    'MsgBox (brand)

上面的代码没有提取此url的以下值

"" : {"0":"B0037RYT96","1":"B0152VYOQ2","2":"B0152WOT70","3":"B003W0NYKS","4":"B0152WOT8Y","5":"B00C2O7M1M","6":"B0037RMS6W","7":"B0037RMI0S","8":"B0152VYPXY"},


我在你的代码中看不到任何试图提取这个的东西

您可以使用regex指定适当的模式来提取该字符串。下面,您要查找的字符串存储在
r
变量中

编辑:

如果您对所需字符串进行了编辑,则可以将正则表达式更改为:

\"dimensionToAsinMap\" :(.*)[^\r\n].*
试试看

以前的答案:

试试正则表达式


本地窗口检查:


正则表达式解释:


我已经用正则表达式更新了您编辑模式的答案。