+ Reply to Thread
Results 1 to 4 of 4

Prevent a user from running a macro

  1. #1
    Registered User
    Join Date
    11-04-2006
    Posts
    30

    Prevent a user from running a macro

    Well, here is what I am trying to do, and how I am going about doing it. I have a couple of questions. Maybe there is a better way of doing this.

    I created a custom toolbar that currently has 7 macros on it. When the workbook opens, it automatically loads the toolbar. There are a couple of macros that I don't want everybody to be able to run. I have a worksheet that has some validation information in it. There is a list of user names with a column that basically states whether or not the user should have access to all macros.

    What I planned to do was find the user that was running the macro. Look them up on the validation worksheet to see if they can run all macros. If not, then don't let them execute the macro (exit the macro).

    How do I find the user trying to run the macro? The spreadsheet is not a shared spreadsheet. Only one user can be in it at a time. I was going to use...
    ActiveWorkbook.UserStatus(1, 1)
    However, is this the best thing to do? Is it really telling me who the user is that is running it?

    Is there another way to prevent the user from running certain macros?

    Thanks for the help.

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by vbace2
    Well, here is what I am trying to do, and how I am going about doing it. I have a couple of questions. Maybe there is a better way of doing this.

    I created a custom toolbar that currently has 7 macros on it. When the workbook opens, it automatically loads the toolbar.
    Provided that the user didn't open with security set to not run macros?
    There are a couple of macros that I don't want everybody to be able to run. I have a worksheet that has some validation information in it. There is a list of user names with a column that basically states whether or not the user should have access to all macros.

    What I planned to do was find the user that was running the macro. Look them up on the validation worksheet to see if they can run all macros. If not, then don't let them execute the macro (exit the macro).

    How do I find the user trying to run the macro? The spreadsheet is not a shared spreadsheet. Only one user can be in it at a time. I was going to use...
    ActiveWorkbook.UserStatus(1, 1)
    However, is this the best thing to do? Is it really telling me who the user is that is running it?

    Is there another way to prevent the user from running certain macros?

    Thanks for the help.
    from the Help,

    MsgBox "Current user is " & Application.UserName

    should help, but security is not all that strong, just enough to beat the office clerks.

    ---
    Si fractum non sit, noli id reficere.

  3. #3
    Registered User
    Join Date
    11-04-2006
    Posts
    30
    Bryan,

    Thanks for the info.

    When you say... should help, but security is not all that strong, just enough to beat the office clerks.

    Do you mean because the user could just change their name under tools - options - general?

    If so, I can live with that. If not, can you give me a little more info.

    Thanks again.

  4. #4
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by vbace2
    Bryan,

    Thanks for the info.

    When you say... should help, but security is not all that strong, just enough to beat the office clerks.

    Do you mean because the user could just change their name under tools - options - general?

    If so, I can live with that. If not, can you give me a little more info.

    Thanks again.
    Hi,

    See my first comment.

    Your macros will only work IF the user 'enables macros'

    If the macro itsself is doing the test, then the macro is probably visible in Tools, Macros
    (and copy-able and the copy amend-able)

    If all else fails the office hacker, there is always a bit of software to remove security, but most users won't bother looking.

    ---

+ Reply to 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