Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
XL2000 - Password to Modify Problem LPS Excel Discussion (Misc queries) 2 November 8th 08 04:38 PM
Copying text to password boxes neeraj Excel Discussion (Misc queries) 3 September 21st 05 06:54 PM
Editing XL95 custom menus with XL97 windsurferLA Excel Worksheet Functions 11 February 1st 05 06:26 PM
Create CommandBar in xl95 code - possible? jamieuk Excel Programming 5 February 9th 04 02:23 PM
VBA for XL95, Workbook.open non XL-file Dick Kusleika[_2_] Excel Programming 0 September 6th 03 02:49 AM


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

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

About Us

"It's about Microsoft Excel"