Is this correct?

  • Thread starter Thread starter Tracey
  • Start date Start date
T

Tracey

I am trying to have the workbook unprotect itself before closing and it
doesn't appear to be working. Here's what I'm doing. Is this the
correct usage of the Workbook_Beforeclose() function?

Private Sub Workbook_BeforeClose()
Application.Worksheets.Unprotect
End Sub

I'm thinking that maybe the worksheets keyword is wrong, should it be
workbook?

Thanks
Tracey
 
Tracey,

Remember that when you open a workbook, you're only looking at
a "copy" of it. The original is unchanged on your hard drive until
you save over it.
Try your code in the Workbook_BeforeSave Event.

John
 
Tracey,

Try this

ThisWorkbook.Unprotect

If the workbook has a password, you will have to supply that, circa

ThisWorkbook.Unprotect("password")

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top