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 123Simply 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-
click enable macro and check the boxes as per picture
click enable macro
put password 123 or your which you have written in place of 123
click ok
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