Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Password Boxes from xl95 to xl2000
I have a customised excel package in xl95 which uses the old dialog boxes
for password protection. I need to update it now to xl 2000 onwards and the ability to change the password, if necessary, by the user. The old code is as below! I'm not expecting anyone to rewrite it!! Any ideas Jim <<Dim PassDialog, HiddenEB, DisplayEB Dim PWord As String Const Password = "manson" Sub TillTakingsPassword() Dim StayInLoop As Boolean SetVariables DisplayEB.Enabled = False 'Display box cannot be tabbed to StayInLoop = True While StayInLoop HiddenEB.Text = "" DisplayEB.Text = "" PWord = "" If PassDialog.Show Then If PWord = Password Then MsgBox "Welcome to the Masons Arms Daily Till Sheet", 4160, "Masons Arms - Till Takings" StayInLoop = False TillTakingsSelect Toolbars("Mats").Visible = True Toolbars("Mats").Position = xlTop Else MsgBox "The password is not : " + PWord, 4112, "Masons Arms - Till Takings" End If Else MsgBox "Press OK to Exit", 4144, "Masons Arms - Till Takings" StayInLoop = False End If Wend End Sub Sub MaskPassword() PWord = HiddenEB.Text DisplayEB.Text = String$(Len(PWord), "*") End Sub Sub SetVariables() Set PassDialog = ThisWorkbook.DialogSheets("dboxTillTakingsPassword ") Set HiddenEB = PassDialog.EditBoxes("HiddenEB") Set DisplayEB = PassDialog.EditBoxes("DisplayEB") End Sub 'Shows end of first password macro |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Password Boxes from xl95 to xl2000
Jim, you can re-write using a userform with a textbox. You can set the
textbox password character to a "*" so that the actual password does not appear. To display a userform, you would use a statement like UserForm1.Show To close the form, you would put the statement "Me.Hide" in a button's click procedure. You access the click procedure by double clicking the button on the form when in the VB editor. If you have an OK and a Cancel button, you can set a public boolean variable to True if OK is clicked and False if the Cancel button is clicked. Then, in your main calling procedure you check this value immediately after the Show statement. You can also have the code in the OK button procedure check to see if the password is valid before closing the form. Hope this helps, Bob Flanagan Macro Systems http://www.add-ins.com Productivity add-ins and downloadable books on VB macros for Excel "Jim" wrote in message .. . I have a customised excel package in xl95 which uses the old dialog boxes for password protection. I need to update it now to xl 2000 onwards and the ability to change the password, if necessary, by the user. The old code is as below! I'm not expecting anyone to rewrite it!! Any ideas Jim <<Dim PassDialog, HiddenEB, DisplayEB Dim PWord As String Const Password = "manson" Sub TillTakingsPassword() Dim StayInLoop As Boolean SetVariables DisplayEB.Enabled = False 'Display box cannot be tabbed to StayInLoop = True While StayInLoop HiddenEB.Text = "" DisplayEB.Text = "" PWord = "" If PassDialog.Show Then If PWord = Password Then MsgBox "Welcome to the Masons Arms Daily Till Sheet", 4160, "Masons Arms - Till Takings" StayInLoop = False TillTakingsSelect Toolbars("Mats").Visible = True Toolbars("Mats").Position = xlTop Else MsgBox "The password is not : " + PWord, 4112, "Masons Arms - Till Takings" End If Else MsgBox "Press OK to Exit", 4144, "Masons Arms - Till Takings" StayInLoop = False End If Wend End Sub Sub MaskPassword() PWord = HiddenEB.Text DisplayEB.Text = String$(Len(PWord), "*") End Sub Sub SetVariables() Set PassDialog = ThisWorkbook.DialogSheets("dboxTillTakingsPassword ") Set HiddenEB = PassDialog.EditBoxes("HiddenEB") Set DisplayEB = PassDialog.EditBoxes("DisplayEB") End Sub 'Shows end of first password macro |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Password Boxes from xl95 to xl2000
Hi Bob
Some sample Code would be appreciated Regards Jim "Bob Flanagan" wrote in message ... Jim, you can re-write using a userform with a textbox. You can set the textbox password character to a "*" so that the actual password does not appear. To display a userform, you would use a statement like UserForm1.Show To close the form, you would put the statement "Me.Hide" in a button's click procedure. You access the click procedure by double clicking the button on the form when in the VB editor. If you have an OK and a Cancel button, you can set a public boolean variable to True if OK is clicked and False if the Cancel button is clicked. Then, in your main calling procedure you check this value immediately after the Show statement. You can also have the code in the OK button procedure check to see if the password is valid before closing the form. Hope this helps, Bob Flanagan Macro Systems http://www.add-ins.com Productivity add-ins and downloadable books on VB macros for Excel "Jim" wrote in message .. . I have a customised excel package in xl95 which uses the old dialog boxes for password protection. I need to update it now to xl 2000 onwards and the ability to change the password, if necessary, by the user. The old code is as below! I'm not expecting anyone to rewrite it!! Any ideas Jim <<Dim PassDialog, HiddenEB, DisplayEB Dim PWord As String Const Password = "manson" Sub TillTakingsPassword() Dim StayInLoop As Boolean SetVariables DisplayEB.Enabled = False 'Display box cannot be tabbed to StayInLoop = True While StayInLoop HiddenEB.Text = "" DisplayEB.Text = "" PWord = "" If PassDialog.Show Then If PWord = Password Then MsgBox "Welcome to the Masons Arms Daily Till Sheet", 4160, "Masons Arms - Till Takings" StayInLoop = False TillTakingsSelect Toolbars("Mats").Visible = True Toolbars("Mats").Position = xlTop Else MsgBox "The password is not : " + PWord, 4112, "Masons Arms - Till Takings" End If Else MsgBox "Press OK to Exit", 4144, "Masons Arms - Till Takings" StayInLoop = False End If Wend End Sub Sub MaskPassword() PWord = HiddenEB.Text DisplayEB.Text = String$(Len(PWord), "*") End Sub Sub SetVariables() Set PassDialog = ThisWorkbook.DialogSheets("dboxTillTakingsPassword ") Set HiddenEB = PassDialog.EditBoxes("HiddenEB") Set DisplayEB = PassDialog.EditBoxes("DisplayEB") End Sub 'Shows end of first password macro |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
XL2000 - Password to Modify Problem | Excel Discussion (Misc queries) | |||
Copying text to password boxes | Excel Discussion (Misc queries) | |||
Editing XL95 custom menus with XL97 | Excel Worksheet Functions | |||
Create CommandBar in xl95 code - possible? | Excel Programming | |||
VBA for XL95, Workbook.open non XL-file | Excel Programming |