I have a Workbook in Dropbox that can be shared with several users. In an attempt to stop a user from opening the workbook while it is opened by another user, I do the following.
[I am SORRY but I do not know where the Code Tag is. I know that I need to put my code within this tag but ...]
in ThisBorkBook Workbook_Open:
I look for a specific file "LOCK_FILE"
If "LOCK_FILE" does not exist, I ask the User for their name and then create "LOCK_FILE" with the current user's name as the first and only line in the text file.
The Excel app then goes about its business with the user running various options from the "Welcome/Menu Page".
When the user selects Exit from the "Welcome/Menu Page", I delete "LOCK_FILE" and Save and Quit the Excel app.
If "LOCK_FILE" does exist, I display a message indicating who is using the file from the info in "LOCK_FILE".
I then attempt to Close the Excel "instance" just opened. NOTE: This is the issue.
The second user can then try to "sign in" at some other time.
If the same user has the file for a long period, they can be notified and hopefully will close the Excel app.
To this point, I have not been successful in closing this second "instance" of the Excel app.
I have tried various things that work in Debug mode but will not do the job in "real time".
My last attempt brings up a blank workbook after the close.
I would add the code here but it is a mess because of so many attempts to solve my issue.
Also if someone could explain how to use the Code Tag, I will supply what code I have, mess or not.
I am sure there are other ways to accomplish what I am attempting to do.
I do like having the ability to know who has the file open so that the second user can contact them to see when they might be finished or if they just forgot to Exit the app.
I plan to have additional information in the lock file such as start time, user email address, user phone number, and other various pieces of information.
Final comment. I am testing using just one computer. In real life, the users will be on their computers.
I do have two computers and do not believe that this makes any difference in execution but I have not "wrestled it to the ground" yet.
Thanks for any help you might provide.
Dan
Bookmarks