View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
pianoman[_16_] pianoman[_16_] is offline
external usenet poster
 
Posts: 1
Default Password Protecting a particular Sub


Magic Harald,
Works just fine.

Many thanks,

Gareth

Harald Staff Wrote:
In its simplest form

Private Sub CommandButton4_Click()
If InputBox("Password please:") < "Top Secret" Then Exit Sub
Overduepdp
ProtectSheet
End Sub

HTH. Best wishes Harald

"pianoman"
skrev i
melding ...

Hi All,
I'm looking to put in some sort of protection that will require a
password to run a particluar sub in an excel file. The sub will be
attached to a button...

I had thought that I should pop up an input box (somehow!) and then
compare the input from the user to a defined constant in the code...

is
this the best way, and if so, how do I write the input box code?

Here's the button code as it stands... it's nothing special!

Private Sub CommandButton4_Click()
Overduepdp
ProtectSheet
End Sub

Thanks all.

Gareth


--
pianoman

------------------------------------------------------------------------
pianoman's Profile:
http://www.excelforum.com/member.php...o&userid=33712
View this thread:

http://www.excelforum.com/showthread...hreadid=544564



--
pianoman
------------------------------------------------------------------------
pianoman's Profile: http://www.excelforum.com/member.php...o&userid=33712
View this thread: http://www.excelforum.com/showthread...hreadid=544564