View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
onedaywhen onedaywhen is offline
external usenet poster
 
Posts: 459
Default Is workbook open anywhere in network

if the file stays open too long I can now contact
the user and ask them to close it


What if the user closes it but another user detects it has been closed
so they open it and your text file is locked because you've got it
open...?

My point is, you could get the workbook to look for a particular
string in the text file. This command could instruct the workbook to
close itself. You could manually add the command, giving you more
control over who can have the workbook open.

Consider using a database rather than a text file so that it can be
accessed simultaneously by you and the workbook (i.e. to avoid file
locking) and you could add a password to prevent anyone else accessing
it. A one table Jet database would do.

--

"Michael Bond" wrote in message ...
Harald, Colo

I've combined both solutions and now have a text file
which logs everyone's use of the file (useful for
historical checking on who is accessing the file), and a
separate log file which shows who the current "read/write"
user is (includes username, computer name and date/time
opened). The log file is killed when the main file is
closed. My update application checks for the existence of
the log file. If not there it opens the file and runs my
update. If it is there it starts another sub which loops
at time intervals checking for the existance of the
file...and pops up a message when the file becomes
free....if the file stays open too long I can now contact
the user and ask them to close it....your idea has proved
most useful...I'm glad I asked.

Thanks and regards

Michael Bond

-----Original Message-----
Good morning

I have a workbook located on a network directory to which
many users have access.

I am writing additional code to update that wokbook from
time to time.

I want to be able to tell, before any action is taken, if
anyone already has the workbook open, either "read only"
or "read/write"

Is is possisble to do this....and if so can the user who
has it open "read/write" be identified.

The file is not shared.

Using Win2000 and Excel2000

Thanks and regards

Michael Bond

.