更改Excel Web查询的URL [英] changing a URL for Excel Web Query

查看:158
本文介绍了更改Excel Web查询的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Excel 2010电子表格,该电子表格可从数据连接中获取信息.在连接的属性上是连接字符串",它是带有几个参数的URL,这些参数在查询字符串中传递给服务器.如果单击编辑查询",则可以更改URL,然后根据新URL导入新数据.我需要通过VBA进行此操作.

I have an Excel 2010 spreadsheet that gets information from a data connection. On the properties of the connection is the "connection string" which is a URL with several parameters that are passed to the server in the query string. If you click "edit query" you can change the URL and then import new data based on the new URL. I need to do this via VBA.

假设连接字符串当前为http://myserver.com?name=foo 我需要将其更改为http://myserver.com?name=bar

Let's say the connection string is currently http://myserver.com?name=foo I need to change that to http://myserver.com?name=bar

这怎么办?

推荐答案

With ActiveSheet.QueryTables(1)
    .Connection = "URL;" & NewURL
    .Refresh
End With

这篇关于更改Excel Web查询的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆