ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help! (https://www.excelbanter.com/excel-programming/295415-help.html)

novice

Help!
 
Have 2 questions:

How do I place a password (Message Box) to protect code
from being executed (Assigned to a button command)?

How can I prevent the user from accessing the sheet tabs
(by using the "Options" feature also)?

Frank Kabel

Help!
 
Hi
1. Protecting your macro execution: One way:
- put the following code at the beginning of your macro:
sub foo()
Dim ret_pwd
ret_pwd = Application.inputbox("please enter your password")
if ret_pwd <"your_password" then
msgbox "PWD was invalid"
exit sub
end if
'now your code follows
end sub

Note: This is not bullet proof. You also may protect your VBA code to
make it a little bit more difficult to read the password in your code

2. Not sure what you mean with this? You may hide the sheets and the
tabs and protect your workbook ('Tools - Protection')


--
Regards
Frank Kabel
Frankfurt, Germany


novice wrote:
Have 2 questions:

How do I place a password (Message Box) to protect code
from being executed (Assigned to a button command)?

How can I prevent the user from accessing the sheet tabs
(by using the "Options" feature also)?




All times are GMT +1. The time now is 05:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com