Closed Thread
Results 1 to 4 of 4

Access control on Button in Excel form

  1. #1
    Registered User
    Join Date
    11-05-2006
    Posts
    11

    Access control on Button in Excel form

    Hi,

    I have created a new button on one of the forms I have created in Excel. I have attached VBA code to this button.

    I would need only certain persons to have access to this button. Other users should not be able to click on this button.

    Is there any way how this access control can be handled? either based on some password or some other way?

    Thanks in advance,

    Warm regards,
    --Prasad

  2. #2
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394
    You can use the UserName field that is stored in the Tools\Options section. Trouble is it is not really secure as anyone can change their own name, and many people don't update the field anyway.

    Here is the proper way

    http://blogs.officezealot.com/charle...2/10/3574.aspx

    edit:
    So it looks like this will give you the user name

    Right(environ(38), Len(environ(38)) - 9)

    All you need to do is test the username, then hide or display the button based on the user
    Last edited by Mallycat; 11-09-2006 at 05:00 AM.

  3. #3
    Registered User
    Join Date
    11-05-2006
    Posts
    11
    Thanks for your inputs.

    Proper way as mentioned by you seems to be little complicated for a VBA novice person like me!!

    Can you please elaborate little more the earlier approach suggested by you of using user name from tools-options?

    Warm regards,
    --Prasad

  4. #4
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394
    Sorry, I was just editing my previous post when you posted. Go back and have another look - I found an easier way.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1