View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Auto / Timed Closure

Look at help for application.Ontime on Chip Pearson's site:

http://www.cpearson.com/excel/ontime.htm

Use it with the workbook level selectionchange event.
http://www.cpearson.com/excel/events.htm

Each time a selection is made, cancel any pending ontime event that will
close the workbook and schedule a new one for 10 minutes hence. If the
workbook is open in readonly mode (check the property), then do nothing.
If you want to check whether it is in the foreground, you would need to use
the windows api to do that I believe.

--
Regards,
Tom Ogilvy


"MAS" wrote in message
...
Hi,

I have played with this one for hours but its driving me mad..

I have read/write access to a workbook that I access via an internal
network. If It's not already open in write mode by one of the other 3
terminals that have the same read/write access, I can only open it in read
only until prompted that whoeven had it open in write mode has now closed
it. Every terminal can have it open in read only mode without it affecting
the write access.

The problem is that sometimes, the workbook gets left open in write mode

and
forgotten about because its minimised or hidden behind another

application,
meaning I have to go search for where its open in write mode and close it
myself.

What I want to do is create a timeout so that when the workbook has not

had
focus for say 10 minutes, it saves any changes and closes.

This must only happen on the terminal that had the workbook in write mode
and those who had it in read only mode should be unaffected..

Good one Eh ?

Any ideas most welcome.