Msgbox Users in a file

Mudbutt

Board Regular
Joined
Jul 18, 2011
Messages
158
I have a shared workbook, and I want a message box to return to me who (if anyone) is in the file before my macro unshares it automatically so people don't lose their work. I found this code which inputs the users onto a worksheet, but I want to work it into my code as more of an error handling thing. Of course, it would need to exclude myself. Here is what I have thus far:

Code:
Dim vUsers As Variant
   vUsers = Activeworkbook.UserStatus
   'Write list to active worksheet
   ActiveSheet.Cells(1, 1).Resize(UBound(vUsers, 1), UBound(vUsers, 2)).Value = vUsers
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Dunno if this works with more than one user:

Code:
Sub ShowEm()
    MsgBox Prompt:=Join(WorksheetFunction.Index(ActiveWorkbook.UserStatus, 0, 1), vbLf), _
           Title:="Users"
End Sub
 
Upvote 0
How about now?

Code:
Sub ShowEm()
    With WorksheetFunction
        MsgBox Prompt:=Join(.Transpose(.Index(ActiveWorkbook.UserStatus, 0, 1)), vbLf), _
               Title:="Users"
    End With
End Sub
 
Upvote 0
That works beautifully, thank you so much!! Do you know if there is a way to exclude myself?
 
Upvote 0

Forum statistics

Threads
1,224,614
Messages
6,179,906
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top