views:

155

answers:

0

I have an Excel spreadsheet featuring a macro that updates the connection string for a couple of query tables, refreshes them, and then saves a copy of the file. (i.e., "Extract the data for x client into this table, and this one, then save the file so I can send it.")

I'd like to expand its capabilities so that it can do this a series of times in one hit - produce all the clients at once.

However, my looped version runs through the first time, and then crashes out on second run as soon as it hits the first 'update connection string' statement for the second time, with an error message "This operation cannot be done because the data is refreshing in the background."

It doesn't seem to be doing so - I've looked at the copied spreadsheet, and it appears to have different values than the page started with. I've also tried to include 'sleep' statements to give it a chance to catch up with the universe - which didn't seem to help.

Any ideas?