Hi all and a Happy New Year
I have a workbook saved on our network drive. I have been able to create a code to restrict users from accessing a ReadOnly version, in other words only 1 person can have the file open at a time.
What I want to achieve now is for the name of the person who has the file locked to appear in a MsgBox when a 2nd user tries to open the file. He will receive a message that ReadOnly is disable and needs to contact person x. I know that Excel already has a popup to show who has locked the file, and then provides options to click ReadOnly or Notify. The reason I want the name in my own MsgBox is so that the user does not have to re-open the file to find out who is locking the file - in case the user did not pay attention to the Excel popup!
I have been searching this forum and have found a solution to the problem, now I just need some help getting it to work.
I have the following code in my ThisWorkBook:
Please Login or Register to view this content.
The bit of code which I need to get working is:
This is the problem I am facing:Please Login or Register to view this content.
- When I enter this code in a new WorkBook it works, when I try to add the code to this workbook it is showing me errors to define Users = and For Row =. I defined them as Dim Users as String and Dim Row as Integer but that does not seem to work. When the code is entered in a new WorkBook with only this code in the ThisWorkBook section VB does not ask me to define anything ...
- In my message box, if i delete "The current user is: & Sheets("User").Range("a1")", _ it works, but with the line added it gives me an error and shows the line in red , perhaps I am doing something wrong with my " _ & ( ) characters
Help will be much appreciated. I am just about to give up on the idea.
Bookmarks