Thread: [Solved] Password Protect a Macro
View Single Post
 
Old 01-13-2015, 07:41 PM
jjfreedman jjfreedman is offline Windows 7 64bit Office 2013
Advanced Beginner
 
Join Date: May 2012
Location: https://jay-freedman.info
Posts: 39
jjfreedman is on a distinguished road
Default

At the start of the code, use the InputBox function to ask the user to put in the password. Compare the returned string to the real password. If they aren't equal, execute the command Exit Sub.

To prevent users from simply opening the macro editor and reading the password from the code, apply a password to the code project (you'll find that in the macro editor's menu Tools > Properties > Protection). That password is very easy to break, but most users won't know that.
Reply With Quote