excel vba - User can unprotect vba protected sheets without providing the password -
i've placed worksheets protection lines follows:
private sub workbook_open() worksheets("sheet1").protect password, userinterfaceonly:=true worksheets("sheet1").protect allowfiltering:=true worksheets("sheet2").protect password, userinterfaceonly:=true worksheets("sheet2").protect allowfiltering:=true worksheets("sheet3").protect password, userinterfaceonly:=true worksheets("sheet3").protect allowfiltering:=true worksheets("sheet4").protect password, userinterfaceonly:=true worksheets("sheet4").protect allowfiltering:=true end sub
however, whenever click unprotect worksheet
main menu, excel doesn't ask password , unprotects sheet. doing wrong here?
thanks all!
worksheets("sheet1").protect password, userinterfaceonly:=true, allowfiltering:=true
do each line , should work well, assuming did put password sting variable password
Comments
Post a Comment