如果我使用参数作为变量,那么我将得到输出
"回复":"错误","错误":"未找到电影"
即
fname = Range("B1").Value
fyear = Range("C1").Value
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.omdbapi.com/?t=fname&y=fyear", _
Destination:=Range("B1"))
如果我使用它:
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.omdbapi.com/?t=Jaws: The Revenge&y=1987", _
Destination:=Range("A1"))
然后它将检索结果。 我对此感到困惑,请帮我找出错误。
答案 0 :(得分:0)
With ActiveSheet.QueryTables.Add(Connection:= _"URL;http://www.omdbapi.com/?t=" & fname & "&y=" & fyear, _ Destination:=Range("B1"))
您可能需要解析fname数据以替换空格和其他在网址中无效的字符。