Show UserName for all active user

saintjhony

New Member
Joined
Jun 1, 2015
Messages
2
I'm not finding a solution to my problem. At work I have a shared worksheet saved in the server and I need a macro that displays the name of the active users.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hello Smitty,Here is what I'm trying to do. With the code below I can determine if the file is opened and I would like to also know wich user have the file opened.

Function IsFileOpen(filename As String)


Dim filenum As Integer, errnum As Integer


On Error Resume Next ' Turn error checking off.
filenum = FreeFile() ' Get a free file number.
' Attempt to open the file and lock it.
Open filename For Input Lock Read As #filenum
Close filenum ' Close the file.
errnum = Err ' Save the error number that occurred.
On Error GoTo 0 ' Turn error checking back on.


' Check to see which error occurred.
Select Case errnum


' No error occurred.
' File is NOT already open by another user.
Case 0
IsFileOpen = False


' Error number for "Permission Denied."
' File is already opened by another user.
Case 70
IsFileOpen = True


' Another error occurred.
Case Else
Error errnum
End Select


End Function
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,553
Messages
6,120,182
Members
448,948
Latest member
spamiki

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