Link to home
Start Free TrialLog in
Avatar of Jagwarman
Jagwarman

asked on

vba code to change a password in a macro

I am using the below code which contains a password. Is there any code that would prompt a password change every 30 days?

Sub Approval()
    resp = InputBox("Enter Password")
    Select Case resp
    Case "silver1":
   
    Insert
   
    'Case "password2": Sheet2.Range("$A$2") = "JR"
         'etc
    Case Else: MsgBox "Invalid Password"
    End Select
   
End Sub
Avatar of redmondb
redmondb
Flag of Afghanistan image

Hi, John.

You currently have the passwords hard-coded into the macro. This is doable, but it would be a lot easier if they could instead be stored in a Very Hidden sheet (i.e. on that can only be unhidden via macro). Is that acceptable? If not,
 - What's the name of the module?
 - Please export the current module, redact the existing passwords and post it here. (If code is going to read the code then we need the exact code.)

How many passwords are there?

Do they all work on the same 30 day cycle or do they each have their own?

Thanks,
Brian.
Avatar of Jagwarman
Jagwarman

ASKER

Hi Brian,

This is a different project I am working on to the one we are working on.

Regards
John
John,

Yes, I was aware of that! I'm currently actively involved in 59 open questions and monitoring others.

Regards,
Brian.
OMG that's why you are top of the list with 43,800 points

That really is Multi tasking
John,

Not as big as it sounds, for example the oldest item on my list was opened on the 1st of November 2011. It's most recent activity was a year after that. I don't find it very demanding!

Now back to the current question - any answers?

Thanks,
Brian.
Hi Brian

You currently have the passwords hard-coded into the macro. This is doable, but it would be a lot easier if they could instead be stored in a Very Hidden sheet (i.e. on that can only be unhidden via macro). Is that acceptable? If not,

I am not sure I understand what you are proposing. After 30 days the user would need to input a new password from a prompt. Reading your note above it sounds like you are proposing the password would be preset on the hidden sheet. Have I misunderstood?

This is the Module/Macro

Sub Approval()
    resp = InputBox("Enter Password")
    Select Case resp
    Case "xxxxxxxx":
   
    Insert
       
    Case Else: MsgBox "Invalid Password"
    End Select
   
End Sub

Regards
John
John,

(1) it sounds like you are proposing the password would be preset on the hidden sheet
No - rather that the passwords would be stored on the Hidden Sheet. (They are currently stored in your macro.)
Is this acceptable?

(2) Your latest code is smaller than your original sample! Do you have multiple passwords or not?

Thanks,
Brian
Hi Brian,

(2) Your latest code is smaller than your original sample! Do you have multiple passwords or not?

I removed a line of code that is not used.

No Just the one password.

Regards
John
John,

And question (1)?

Brian.
Brian

1) Yes I would say it is acceptable

Regards
John
ASKER CERTIFIED SOLUTION
Avatar of redmondb
redmondb
Flag of Afghanistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, John.