QA–QC BYUNS – Note – "This site uses cookies from Google to deliver its services to personalize ads and to analyze traffic information about your use of this site is shared with Google, BY USING THIS SITE YOU AGREE TO ITS USE OF COOKIES"

Monday, December 30, 2019

ADD PASSWORD

ADD PASSWORD TO EXCEL WORKBOOK

The below code will ask you to enter the password, as you try to open it. after putting the password it will show a message welcome. you can put your password in place of 123
Simply copy below code and paste in excel module.

Private Sub Workbook_Open()

a = InputBox("Enter the Password")

If a = 123 Then
 MsgBox " Welcome"
Else
 MsgBox "Incorrect Password"
 ThisWorkbook.Save
 ThisWorkbook.Close
End If

End Sub


sample picture is as below-
VBA
if your macro is not enable then please do the below thing-

VBA



click enable macro and check the boxes as per picture
VBA


click enable macro
put password 123 or your which you have written in place of 123
VBA



click ok
VBA

enjoy

if your developer tab is not ON then make it on , see blog "developer tab" in blog list for how to on developer tab in excel..




No comments:

Post a Comment

Please do not enter any spam link in the comment box