PDA

View Full Version : Shared workbooks and who is using them.



jmaocubo
05-19-2010, 10:12 AM
Hello everyone

I have several workbooks in a folder that is shared by several users.
Is there any possibility to create a code in a workbook to contain the list of all workbooks that let me know what workbooks are open and the username who as it open?


Thanks in advance

fourstar787
08-12-2010, 06:36 AM
i am looking at a similar problem!
I would like to know if there is a vba code for showing current users with a shared workbook open!

jmaocubo
08-12-2010, 07:32 AM
i am looking at a similar problem!
I would like to know if there is a vba code for showing current users with a shared workbook open!
Hi!!! Fourstar787

I resolved the problem for me....


In Workbook

Private Sub Workbook_Open()
Call aa
End Sub
In module


Public Sub aa()


If ActiveWorkbook.Path = "C:\m" Then ' <= change to correct path
MsgBox "OK"
Else
MsgBox "ERROR"
ThisWorkbook.Close

End If
End Sub
See if it work's for you....

Correction: this is to allow only the users you choose

fourstar787
08-12-2010, 08:59 AM
Thanks for the reply, but i think our dilemas differed somewhat!


my inquiry was to see if i could list users actively sharing a workbook, so i could remove them (before manipulating the data into another workbook!)
I got round the problem by using



Windows("20100422-Shared Taskings Register-U.xls").Activate
Windows("20100422-Shared Taskings Register-U.xls").Save
Dim au As Integer
au = 1
Do Until au = 10
Application.DisplayAlerts = False
' one of the users is me and produces and error hence the next line
On Error Resume Next
ActiveWorkbook.RemoveUser (au)
au = au + 1
Loop
Windows("20100422-Shared Taskings Register-U.xls").Close