View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vergel Adriano Vergel Adriano is offline
external usenet poster
 
Posts: 857
Default Make onTimer wait until Excel finish database request?

In the OnTimer event, check first if the database query is refreshing or not
before saving the workbook. Assuming the database query is in Sheet1, and
that there is only one query, then in the onTimer event in VBA

If Not Sheet1.QueryTables(1).Refreshing then
thisworkbook.save
End If


Another way is to disable the automatic refresh of the database query and
let your VBA code do the refresh. In this way, you have full control of both
events.


"news.stofanet.dk" wrote:

Hi all,

I have a spreadsheet that:
1) Every minute connect to a database importing data to Excel (no vba)
2) Every half hour save the spreadsheet to disk (vba onTimer event)

Sometimes the two "timers" collide bringing up a popup, asking if the user
will save now, or wait for the update. It stops everything.

Is there a way to avoid the popup? - It does not matter if the current
database update or save is canceled.

--
Hans