Unexpected behavior when refreshing internal data connections in Excel

心已入冬 提交于 2020-01-05 23:29:05

问题


I have faced a big and inconvenient problem with Excel spreadsheets that have internal data connections (queries that selects ranges of the own workbook) in them.

I wiil start by showing the problem e exposing how to reproduce it.

Problem: if I have some internal connetion and another instance (pay attention, instance, not other workbook) was already open, when refreshing that connection, the same workbook (which have the internal connection) is instantly opened in readonly mode in another window...

Why this occurs? The problem is that I'm developing a .NET automation application for Excel and this behavior breaks some process flow (because the readonly file stays open and sometimes it causes a non refresh in the original workbook)

To solve this problem I began to use the same instance if it is already open, but this is not the best solution because I need to handle the concurrency when running several VBA macros in the same instance via .NET Interop.

Here a workbook for those who wish to test this issue that I presented (just change the string connection inserting the new file path in your computer):

Excel File for Test

I recorded a video to show you the issue with more details and how to reproduce it. Please, take a look:

Video

I hope someone knows how to solve this problem because I've been searching for this several days...

Thanks

Obs.: The Office version is 2013

来源:https://stackoverflow.com/questions/32540576/unexpected-behavior-when-refreshing-internal-data-connections-in-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!