PC Review


Reply
Thread Tools Rate Thread

Comparing password entry vs stored password - 2003

 
 
L Mehl
Guest
Posts: n/a
 
      19th Nov 2004
Hello --

A worksheet has a button which, when clicked, shows a list of sales regions
and allows changing the region on a quotation.
Users of the sheet are permitted to change the region, prior to preparing
the quote.

The completed quote (the workbook containing the sheet) is sent to the
customer, who can change other cells on the sheet (sensitivity analysis),
but not the sales region.

I currently have the following code on the button click to control access to
the regions list:
....
frmPWEntry.Show 'contains 1 field: txtPWEnter, for entry of password,
masked with "****"

strPassword = frmPWEntry.txtPWEnter.Value

If strPassword = "1234" Then
frmSelectRegion.Show 'listbox allows selection of region
End If

Unload frmPWEntry
....

Problem: User will occasionally want to change the workbook password via
menu selections, and would prefer not to also have to change VBA behind the
workbook in order to maintain the button's "protection".

Tom Ogilvy's recent mention of "ActiveWorkbook.HasPassword = ..." prompts me
to ask the following:

Is there an ActiveWorkbook. ... which knows the password and against which
VBA can test ("behind the scenes") the entered password string?

If so, my code could look like

strPassword = frmPWEntry.txtPWEnter.Value

If ActiveWorkbook. ... = strPassword Then
frmSelectRegion.Show
End If


Thanks for any help.

Larry Mehl


---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.797 / Virus Database: 541 - Release Date: 11/15/2004


 
Reply With Quote
 
 
 
 
Sharad Naik
Guest
Posts: n/a
 
      19th Nov 2004
There is ActiveWorkBook.Password Property to read the password but
it returns the encrypted password and you can't compare it with your string.

What you can do it as under:

Err.Clear
On Error Resume Next
ActiveWorkbook.Unprotect (strPassword)
If Err = 0 Then
ActiveWorkbook.Protect strPassword, True, True
On Error GoTo 0
End If
frmSelectRegion.Show

I.e. you try to unportect the workbook, with the password provided by the
user.
If the password is not correct, an error is generated (Err <> 0.). If no
error is generated (Err=0),
it means the password was correct and workbook has been unprotected.
So you execute your code, protect back the workbook with same password.

Sharad


"L Mehl" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello --
>
> A worksheet has a button which, when clicked, shows a list of sales
> regions
> and allows changing the region on a quotation.
> Users of the sheet are permitted to change the region, prior to preparing
> the quote.
>
> The completed quote (the workbook containing the sheet) is sent to the
> customer, who can change other cells on the sheet (sensitivity analysis),
> but not the sales region.
>
> I currently have the following code on the button click to control access
> to
> the regions list:
> ...
> frmPWEntry.Show 'contains 1 field: txtPWEnter, for entry of password,
> masked with "****"
>
> strPassword = frmPWEntry.txtPWEnter.Value
>
> If strPassword = "1234" Then
> frmSelectRegion.Show 'listbox allows selection of region
> End If
>
> Unload frmPWEntry
> ...
>
> Problem: User will occasionally want to change the workbook password via
> menu selections, and would prefer not to also have to change VBA behind
> the
> workbook in order to maintain the button's "protection".
>
> Tom Ogilvy's recent mention of "ActiveWorkbook.HasPassword = ..." prompts
> me
> to ask the following:
>
> Is there an ActiveWorkbook. ... which knows the password and against which
> VBA can test ("behind the scenes") the entered password string?
>
> If so, my code could look like
>
> strPassword = frmPWEntry.txtPWEnter.Value
>
> If ActiveWorkbook. ... = strPassword Then
> frmSelectRegion.Show
> End If
>
>
> Thanks for any help.
>
> Larry Mehl
>
>
> ---
>
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.797 / Virus Database: 541 - Release Date: 11/15/2004
>
>



 
Reply With Quote
 
Sharad Naik
Guest
Posts: n/a
 
      19th Nov 2004
Sorry the line frmSelectRegion.Show should be above End if.

Sharad
"Sharad Naik" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> There is ActiveWorkBook.Password Property to read the password but
> it returns the encrypted password and you can't compare it with your
> string.
>
> What you can do it as under:
>
> Err.Clear
> On Error Resume Next
> ActiveWorkbook.Unprotect (strPassword)
> If Err = 0 Then
> ActiveWorkbook.Protect strPassword, True, True
> On Error GoTo 0
> End If
> frmSelectRegion.Show
>
> I.e. you try to unportect the workbook, with the password provided by the
> user.
> If the password is not correct, an error is generated (Err <> 0.). If no
> error is generated (Err=0),
> it means the password was correct and workbook has been unprotected.
> So you execute your code, protect back the workbook with same password.
>
> Sharad
>
>
> "L Mehl" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hello --
>>
>> A worksheet has a button which, when clicked, shows a list of sales
>> regions
>> and allows changing the region on a quotation.
>> Users of the sheet are permitted to change the region, prior to preparing
>> the quote.
>>
>> The completed quote (the workbook containing the sheet) is sent to the
>> customer, who can change other cells on the sheet (sensitivity analysis),
>> but not the sales region.
>>
>> I currently have the following code on the button click to control access
>> to
>> the regions list:
>> ...
>> frmPWEntry.Show 'contains 1 field: txtPWEnter, for entry of password,
>> masked with "****"
>>
>> strPassword = frmPWEntry.txtPWEnter.Value
>>
>> If strPassword = "1234" Then
>> frmSelectRegion.Show 'listbox allows selection of region
>> End If
>>
>> Unload frmPWEntry
>> ...
>>
>> Problem: User will occasionally want to change the workbook password via
>> menu selections, and would prefer not to also have to change VBA behind
>> the
>> workbook in order to maintain the button's "protection".
>>
>> Tom Ogilvy's recent mention of "ActiveWorkbook.HasPassword = ..." prompts
>> me
>> to ask the following:
>>
>> Is there an ActiveWorkbook. ... which knows the password and against
>> which
>> VBA can test ("behind the scenes") the entered password string?
>>
>> If so, my code could look like
>>
>> strPassword = frmPWEntry.txtPWEnter.Value
>>
>> If ActiveWorkbook. ... = strPassword Then
>> frmSelectRegion.Show
>> End If
>>
>>
>> Thanks for any help.
>>
>> Larry Mehl
>>
>>
>> ---
>>
>> Checked by AVG anti-virus system (http://www.grisoft.com).
>> Version: 6.0.797 / Virus Database: 541 - Release Date: 11/15/2004
>>
>>

>
>



 
Reply With Quote
 
L Mehl
Guest
Posts: n/a
 
      19th Nov 2004
Sharad --

That is what I needed.

Thanks for the solution.

Larry

"Sharad Naik" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Sorry the line frmSelectRegion.Show should be above End if.
>
> Sharad
> "Sharad Naik" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > There is ActiveWorkBook.Password Property to read the password but
> > it returns the encrypted password and you can't compare it with your
> > string.
> >
> > What you can do it as under:
> >
> > Err.Clear
> > On Error Resume Next
> > ActiveWorkbook.Unprotect (strPassword)
> > If Err = 0 Then
> > ActiveWorkbook.Protect strPassword, True, True
> > On Error GoTo 0
> > End If
> > frmSelectRegion.Show
> >
> > I.e. you try to unportect the workbook, with the password provided by

the
> > user.
> > If the password is not correct, an error is generated (Err <> 0.). If no
> > error is generated (Err=0),
> > it means the password was correct and workbook has been unprotected.
> > So you execute your code, protect back the workbook with same password.
> >
> > Sharad
> >
> >
> > "L Mehl" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> Hello --
> >>
> >> A worksheet has a button which, when clicked, shows a list of sales
> >> regions
> >> and allows changing the region on a quotation.
> >> Users of the sheet are permitted to change the region, prior to

preparing
> >> the quote.
> >>
> >> The completed quote (the workbook containing the sheet) is sent to the
> >> customer, who can change other cells on the sheet (sensitivity

analysis),
> >> but not the sales region.
> >>
> >> I currently have the following code on the button click to control

access
> >> to
> >> the regions list:
> >> ...
> >> frmPWEntry.Show 'contains 1 field: txtPWEnter, for entry of

password,
> >> masked with "****"
> >>
> >> strPassword = frmPWEntry.txtPWEnter.Value
> >>
> >> If strPassword = "1234" Then
> >> frmSelectRegion.Show 'listbox allows selection of region
> >> End If
> >>
> >> Unload frmPWEntry
> >> ...
> >>
> >> Problem: User will occasionally want to change the workbook password

via
> >> menu selections, and would prefer not to also have to change VBA behind
> >> the
> >> workbook in order to maintain the button's "protection".
> >>
> >> Tom Ogilvy's recent mention of "ActiveWorkbook.HasPassword = ..."

prompts
> >> me
> >> to ask the following:
> >>
> >> Is there an ActiveWorkbook. ... which knows the password and against
> >> which
> >> VBA can test ("behind the scenes") the entered password string?
> >>
> >> If so, my code could look like
> >>
> >> strPassword = frmPWEntry.txtPWEnter.Value
> >>
> >> If ActiveWorkbook. ... = strPassword Then
> >> frmSelectRegion.Show
> >> End If
> >>
> >>
> >> Thanks for any help.
> >>
> >> Larry Mehl
> >>
> >>
> >> ---
> >>
> >> Checked by AVG anti-virus system (http://www.grisoft.com).
> >> Version: 6.0.797 / Virus Database: 541 - Release Date: 11/15/2004
> >>
> >>

> >
> >

>
>



---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.797 / Virus Database: 541 - Release Date: 11/16/2004


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FP 2003 has misplaced a stored login and password to my server, gsxith3 Microsoft Frontpage 1 23rd Apr 2009 09:27 AM
Outlook 2003 password entry prompt SMP Microsoft Outlook Installation 2 30th Sep 2008 08:15 PM
Stored Username & Password wiped out after password change Sandie Windows XP Security 0 10th Jan 2008 05:47 PM
My internet account password is not stored in Outlook 2003? why? =?Utf-8?B?U2V2ZXJhbCBMb2dpbiBhdHRlbXB0?= Microsoft Outlook Discussion 0 29th Jan 2007 01:51 PM
After upgrading to Outlook 2003 all my PST files require a password: though no password seems to work!! carlos seramos Microsoft Outlook Installation 2 9th Jan 2004 02:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:13 AM.