Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Dim password As String Private Sub CommandButton4_Click() password = "clearannual" Set passwordinput = Application.InputBox(prompt:="Input Password to Clear Annual Dates", Type:=2) If passwordinput = password Then Overduepdp ProtectSheet Else response = MsgBox("Incorrect Password Supplied. Please try again", vbOKOnly, "Clear Annual dates Password") End If End Sub Obviously it's not working yet... -- pianoman ------------------------------------------------------------------------ pianoman's Profile: http://www.excelforum.com/member.php...o&userid=33712 View this thread: http://www.excelforum.com/showthread...hreadid=544564 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Password Protecting a workbook | Excel Discussion (Misc queries) | |||
Password Protecting | Excel Discussion (Misc queries) | |||
password protecting macros | Excel Programming | |||
Protecting Sheet with Password | Excel Programming | |||
Password Protecting a Macro | Excel Programming |