Я написал следующий VBA-макрос
Sub getMatches()
Dim strURL As String
Dim strJSON As String
Dim strCompetition As Integer
Dim strSeason As Integer
Dim strMatchDay As Integer
Dim i As Integer
'strURL = "https://api.football-data.org/v2/competitions/2021/matches?matchday=1&season=2019"
strURL = "https://api.football-data.org/v2/competitions/" & strSeason & "/matches?matchday=" & strMatchDay & "&season=" & strSeason
strCompetition = Range("B2").Value
strSeason = Range("B4").Value
strMatchDay = Range("B6").Value
MsgBox strCompetition
MsgBox strSeason
MsgBox strMatchDay
MsgBox strURL
Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
MyRequest.Open "Get", strURL
MyRequest.setRequestHeader "X-Auth-Token", "personal_code"
MyRequest.Send
Dim Json As Object
Set Json = JsonConverter.ParseJson(MyRequest.ResponseText)
MsgBox MyRequest.ResponseText
Запустив этот скрипт, я получаю следующий вывод:
MsgBox strCompetition

MsgBox strSeason

MsgBox strMatchDay

MsgBox strURL

Почему URL не содержит переменных, которые я объявил ранее?
Я хочу, чтобы URL был определен следующим образом: "https://api.football -data.org / v2 / Competitions / 2021 / matchs? Matchday = 1 & season = 2019 "