Reputation: 71
In Excel 2007 I Create file and macro (vba), I protected workbook using password and to avoid Security warning when closing file through icon red (X) and reopen file and after save my data and indeed, the problem is solved
Steps
But window Security warning arise when Closing file with Task manager and next reopen file, code down not working
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Unprotect Password:="blabla"
ThisWorkbook.Save
ThisWorkbook.Saved = True
End Sub
Private Sub Workbook_Open()
ThisWorkbook.Protect Password:="blabla"
ThisWorkbook.Save
ThisWorkbook.Saved = True
End Sub
Upvotes: 1
Views: 39