首页 > 解决方案 > 将JSON发布到excel vba中的条纹

问题描述

我正在尝试更新大量的连续框,并且我将所有这些信息都保存在一个 Excel 表中,但是我意识到当发送请求时,我最终在网站上得到了“Sector12”而不是 Sector12.value。

谁能帮我这个?

先感谢您

        With CreateObject("Microsoft.XMLHTTP")
            .Open "POST", "https://www.streak.com/api/v1/boxes/" & boxK & "/fields/1007", False
            .SetRequestHeader "Accept", "application/json"
            .SetRequestHeader "Content-Type", "application/json"
            .SetRequestHeader "Authorization", "Basic " & EncodeBase64("xxxxxxxxxxxxxx")
            Sector12 = Application.WorksheetFunction.VLookup(JsonBox.Item(Index).Item("name"), ActiveSheet.Range("A:D"), 2, 0)


            .Send "{'value':Sector12}"

        End With

标签: jsonvbaexcelapi

解决方案


您将文字字符串 "{'value':Sector12}" 作为 JSON

应该更像这样:

.Send "{'value':" & Sector12 & "}"

推荐阅读