Excel - How to restrict 'Accept / Reject' to one user

I want to be able to allow sharing on a workbook and track changes but I don't want to allow just any user to accept or reject changes.

Ideally this would be without any VBA but if there is no other way ...

Unfortunately I have never worked with shared workbooks.
LVL 3
AL_XResearchAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Select Case Application.UserName
    Case "Martin Liss", "Barack Obama"
        ' allow
End Select

Open in new window

0
Martin LissOlder than dirtCommented:
You can also use Environ$("Username") in the same way.
0
AL_XResearchAuthor Commented:
Hi Martin.

Thanks for the quick response but I am sorry to say I don't understand. Of course that select statement would allow you to check if the current user is allowed but how do you link you code to the 'Accept or Reject' event ?

I can come up with all the VBA validation and testing - all I need to know is how to intercept and apply as needed.

As I say I am ideally looking for a non-VBA solution but if VBA is required then I need to know how to intercept or override the 'another user has made a change - which one wins ?' event.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Martin LissOlder than dirtCommented:
I don't (and can't) work with shared workbooks but in order to do what you want I think you'll need to modify the ribbon for those who you don't want doing it - if that's possible in a shared workbook.

Ron De Bruin has articles on modifying the ribbon.
Here's how you'd get the submenu IDs. (From a comment from him I found on the web.)
Sub GetAll_Submenu_Ids()
Dim ctrl As Object
For Each ctrl In CommandBars("Tools") _
.Controls("Track Changes").Controls
MsgBox ctrl.Caption & Chr(13) & ctrl.ID
Next ctrl
End Sub

Open in new window

0
AL_XResearchAuthor Commented:
Martin: That is certainly one way of doing it but I always avoid working with CommandBar objects - simply because a) we don't know for how long MS will support them (in light of the move to ribbon controls) and b) I am never comfortable about mixing Ribbon and CommandBar work as I can't be sure how much 'internal application conflict' there is between these two rival but very different methods of control.
0
AL_XResearchAuthor Commented:
To put my question another way: what is the best VBA way to automatically accept or reject the current user's changes seamlessly ?
0
Martin LissOlder than dirtCommented:
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Application.UserName
    Case "Martin Liss", "Barack Obama"
        ' allow
    Case Else
        ' reject
        Application.EnableEvents = False
        Application.Undo
        Application.EnableEvents = True
End Select
End Sub

Open in new window

0
AL_XResearchAuthor Commented:
Hi Martin,

Yes that is the simple part of how to distinguish the user and who is allowed - what I want is the code that goes in the section you have marked " ' allow "

By the same taken I need to know how to determine if there changes outstanding for more than one user.
0
Martin LissOlder than dirtCommented:
Please describe the "allow" process.
0
AL_XResearchAuthor Commented:
Well in your code sample of the select block to decide what to do based on the username you have a comment for the ''Allow" case statement - what is the code that would go in there ?
0
Martin LissOlder than dirtCommented:
As I said I don't work with shared workbooks so please don't take this as the final word, but based on several hours of research I don't believe you can do what you want. Please see this article and the first 10 or so comments.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.