#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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)?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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)?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"