Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-13-2015, 04:22 PM
Mark212 Mark212 is offline Password Protect a Macro Windows Vista Password Protect a Macro Office 2007
Novice
Password Protect a Macro
 
Join Date: Jan 2015
Posts: 7
Mark212 is on a distinguished road
Default Password Protect a Macro

Does anyone know how to require a password to run a macro in word?
Reply With Quote
  #2  
Old 01-13-2015, 07:41 PM
jjfreedman jjfreedman is offline Password Protect a Macro Windows 7 64bit Password Protect a Macro Office 2013
Advanced Beginner
 
Join Date: May 2012
Location: http://jay-freedman.info
Posts: 38
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
  #3  
Old 01-14-2015, 02:30 PM
Mark212 Mark212 is offline Password Protect a Macro Windows Vista Password Protect a Macro Office 2007
Novice
Password Protect a Macro
 
Join Date: Jan 2015
Posts: 7
Mark212 is on a distinguished road
Default

Brilliant, thanks very much JJFreedman
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password protect a table in Word Mark212 Word VBA 2 01-14-2015 02:28 PM
Password protect Docx documents timm@bicyclegermany.com Word 3 11-05-2011 03:46 PM
Password Protect a Macro Here!! Help me to remove password protect from pdf priya Word 1 09-17-2011 10:35 AM
How can I protect all my MSW documents with a password ? Antonio Machado Word 0 07-05-2010 07:55 PM
Password Protect a Macro password protect excel file? Dawg751 Excel 2 01-28-2010 06:23 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:15 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2022 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft