Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我发现了一些刷新 XML 映射中数据的 VBA 代码:
ActiveWorkbook.XmlMaps("Map").DataBinding.Refresh
提供 xml 源的服务器有时会很忙,所以我希望能够将默认超时设置为非常短的时间,例如 5 秒,并在发生这种情况时跳到下一段代码。我怎样才能做到这一点?
我不认为你可以在地图绑定时取消(所以如果它成功但仍然需要 5 秒,则无法取消它)。您可以对超时失败做出反应(处理BindingError事件)。
BindingError
它很草率,但您可以使绑定是异步的(ASync属性)并在继续之前等待 5 秒(或BindingInProgress结合使用属性)。然后刷新后的代码无论如何都会执行(超时与否)。
ASync
BindingInProgress