ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Password security (https://www.excelbanter.com/excel-worksheet-functions/231381-password-security.html)

blue

Password security
 
Hi,
I have a macro for protecting sheets & the ability to run the macro is
password protected. Is there any way i can program it so that when i type in
the password people cannot see the letters i am typing? The macro code is as
below:

ub ProtectAll()

Dim sPassword As String
sPassword = "LMW5487"

If Application.InputBox( _
Prompt:="Please enter the password", _
Title:="Password", _
Type:=2) < sPassword Then

MsgBox "Wrong password!"
Exit Sub

End If

Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Protect Password:="LMW5487", DrawingObjects:=False, Contents:=True,
Scenarios:= _
True, AllowFormattingCells:=True, AllowSorting:=True,
AllowDeletingRows:=True, AllowInsertingRows:=True, AllowFormattingRows:=True,
AllowFiltering:= _
True, AllowFormattingColumns:=True

Next ws


End Sub
--
Lois

Dave Peterson

Password security
 
Not if you use an inputbox.

But you could design your own userform and use the passwordchar property to hide
the input.

Debra Dalgleish has some getstarted instructions for userforms at:
http://contextures.com/xlUserForm01.html

Blue wrote:

Hi,
I have a macro for protecting sheets & the ability to run the macro is
password protected. Is there any way i can program it so that when i type in
the password people cannot see the letters i am typing? The macro code is as
below:

ub ProtectAll()

Dim sPassword As String
sPassword = "LMW5487"

If Application.InputBox( _
Prompt:="Please enter the password", _
Title:="Password", _
Type:=2) < sPassword Then

MsgBox "Wrong password!"
Exit Sub

End If

Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Protect Password:="LMW5487", DrawingObjects:=False, Contents:=True,
Scenarios:= _
True, AllowFormattingCells:=True, AllowSorting:=True,
AllowDeletingRows:=True, AllowInsertingRows:=True, AllowFormattingRows:=True,
AllowFiltering:= _
True, AllowFormattingColumns:=True

Next ws

End Sub
--
Lois


--

Dave Peterson


All times are GMT +1. The time now is 05:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com