我在sub中有引用值,但我想在GET语句中使用引用的值。 我想使用我的num1值作为我的脱色=在我的.Open" Get"言。
Dim num1 As String
Set htm = CreateObject("htmlFile")
num1 = Cells(2, 2).Value
With CreateObject("msxml2.xmlhttp")
.Open "GET", "https://maps.googleapis.com/maps/api/distancematrix/json?origins=sy10 5tp&destinations='num1'&mode=driving&language=en-GB&v=3&sensor=fals", False
非常感谢。
答案 0 :(得分:1)
使用"
关闭带引号的字符串文字并使用&
连接运算符附加变量:
x = "abc" & stringVariable & "def"
所以
.Open "GET", "https://maps.googleapis.com/maps/api/distancematrix/json?origins=sy10 5tp&destinations=" & num1 & "&mode=driving&language=en-GB&v=3&sensor=fals", False
(您还有fals
,大概应该是false
)