Macro-password

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can you make a user enter a password before a macro will run, and if so how. I have tried everything I could think of but am not well-versed in VB. Thanks for your help.
 
In its simplest form:

Sub test()
Dim PW As String
PW = "Janet"
If InputBox("Password") <> PW Then Exit Sub
'Macro code here, like:
MsgBox "Thank you for choosing Linux Redhat", _
vbInformation, "Installation complete"
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please.

DJ said:
Can you make a user enter a password before a macro will run, and if so how. I have
tried everything I could think of but am not well-versed in VB. Thanks for your help.
 
Thank you for responding to my question. But I don't
understand part of it ---does this go at the beginning of
the code before my macro code....and where you have a
quote mark and Macro code here, like: am I supposed to put
something there??? Don't I need to put code in for the
inputbox like what cell to be clicked in for this to be
activated and the text like enter password?? I don't know
and need for this to be explained in detail if you don't
mind....thanks so much.

With the way I have it right now - I keep getting a
compile error saying expected: =
-----Original Message-----
In its simplest form:

Sub test()
Dim PW As String
PW = "Janet"
If InputBox("Password") <> PW Then Exit Sub
'Macro code here, like:
MsgBox "Thank you for choosing Linux Redhat", _
vbInformation, "Installation complete"
End Sub
will run, and if so how. I have
 
Back
Top