开发者

How can I change the default Excel XML refresh timeout (using VBA)?

I've found a bit of VBA code that refreshes the data in an XML map:

ActiveWorkbook.XmlMaps("Map").DataBinding.Refresh

The server providing the xml source gets busy sometimes, so I'd like to be able to override the default timeout to something very short, e.g. 5 seconds, and skip to the next开发者_开发知识库 section of code when this happens. How can I do this?


I don't think you can cancel while the map is binding (so if it is successful but still takes 5 seconds there is no way to cancel it). You can react to a timeout failure (handle the BindingError event).

It is sloppy but you could make the binding be asynchronous (ASync property) and put a 5 second wait before continuing on (or use the BindingInProgress property in conjunction). Then your code after the refresh gets executed no matter what (timeout or not).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜