View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
rdwj rdwj is offline
external usenet poster
 
Posts: 95
Default Limiting number of users opening Excel Workbook at one time.

tricky!
What you can try is to use a markerfile (with just one number, ie the number
of current users).
Look under help under "Write" and "Get" how to manage input files.
If you include some VB code in Workbook_Open and Workbook_BeforeClose then
you can use the markerfile as a counter.
Something like

Type Record ' Define user-defined type.
ID As Integer
Name As Integer
End Type

Dim MyRecord As Record, Position ' Declare variables.

' Open sample file for random access.
Open "TESTFILE" For Random As #1 Len = Len(MyRecord)
' Read the sample file using the Get statement.
Position = 1 ' Define record number.
Get #1, Position, MyRecord ' Read third record.

'which will give the variable MyRecord the number in the file
'Now check
if MyRecord 4 then
msgbox("to many users, file will autoclose")
application.close
end if

Write #1, MyRecord + 1

Close #1 ' Close file


in the Workbook_BeforeClose include a similar statement....

"RickatMDG" wrote:

We are trying to limit the number of users that are able to open and work on
an Excel Workbook at the same time to one at a time. Is there a way to
configure the sheets to do this?