file is in use from...

sal21

Active Member
Joined
Apr 1, 2002
Messages
291
i have a .xls file into a dir server with all free permission on this dir, inested the tipical ms message "file is alreday opend from..." when a user open a xls file and jhis is alredy opened the same, is possible:

to show a mshbox:

Attention this file is in use from & "name of user have opoened the file for first" click on msg box close the .xls file...

i use this function to know wich user have opened the .xls file:

Sub USER_NAME()
Dim wshNet
ThisWorkbook.Activate
Sheets("RATE").Select
Set wshNet = CreateObject("WScript.Network")
wshGetUserName = wshNet.UserName
Set wshNet = Nothing
Range("A1") = ""
Range("A1") = UCase(wshGetUserName)
End Sub
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Sub myLocks()
'Sheet Module Code, like: Sheet1.
Dim myWho, myWhen, myHow, myActive

If ActiveWorkbook.MultiUserEditing Then
MsgBox "The current file is a shared file!"
Else
MsgBox "The current file is not a shared file!"
End If

Users = ActiveWorkbook.UserStatus
For Row = 1 To UBound(Users, 1)
myWho = Users(Row, 1)
myWhen = Users(Row, 2)
Select Case Users(Row, 3)
Case 1
myHow = "Exclusive!"
Case 2
myHow = "Shared!"
End Select
myActive = myActive & "User: " & myWho & ", at: " & myWhen & ", as: " & myHow & vbCr
Next
MsgBox "These Users have this Workbook open:" & vbCr & vbCr & myActive

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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