+ Reply to Thread
Results 1 to 7 of 7

Restricting Macros

  1. #1
    Registered User
    Join Date
    02-27-2009
    Location
    Newark, USA
    MS-Off Ver
    2007
    Posts
    29

    Restricting Macros

    I created a Macro to do some copying and pasting. Can I restrict that Macro so that it can only be used from my PC?
    Last edited by Pedroluna; 04-06-2009 at 12:22 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Restricting Macros

    You can but why would it be necessary? You would need to add code to obtain something unique like the hard drive serial number or possibly the computer name.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    02-27-2009
    Location
    Newark, USA
    MS-Off Ver
    2007
    Posts
    29

    Re: Restricting Macros

    The macro copies information into (sensitive) files read by Management. I could create a separte macro file and place it in my hard drive but then it would not be back up. I mostly want to keep others from changing/running the Macro. I tried restricting the file but it does keep others from running it only changing it. I can keep others from opening the file altogehter by password protecting it. Short of that what are my alternitives?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Restricting Macros

    You could keep your macro in Personal.xls, which you can (and should) back up periodically. My Personal.xls includes this:
    Please Login or Register  to view this content.
    I run it each time I add or delete something.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Restricting Macros

    You could get your computer name & then write code to check the PC running the code against the name of your PC. If it is different then stop the code.

    This will get your PC' name
    Please Login or Register  to view this content.
    Once you know the name then
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-27-2009
    Location
    Newark, USA
    MS-Off Ver
    2007
    Posts
    29

    Re: Restricting Macros

    I like the last code w/If Environ("COMPUTERNAME") <> MyPc Then Exit Sub.

    I tried it and works great.

    Thanks,

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Restricting Macros

    Just a caution: It would take someone about five seconds to change their computer name and run the sub.

    Checking the drive serial number would be much more secure. And either way, you need to protect the VBA project.

+ 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