J
Joseph Geretz
The code below cycles through every worksheet and protects it. It then sets
the active worksheet back to the first worksheet.
For Each WkSht In m_DocExcel.Worksheets
WkSht.Protect "mypassword", True, True, True, True
WkSht.Activate
m_AppExcel.ActiveWindow.DisplayGridlines = False
m_AppExcel.ActiveWindow.DisplayHeadings = False
Next WkSht
m_DocExcel.Worksheets(1).Activate
Is it possible to set protection on the entire workbook in one atomic
operation, or do I need to set the protection for each sheet separately, as
I am doing? And is there a more efficient way of setting the appearance
style for every worksheet or must I cycle through them individually as I am
doing? (I guess I could implement events and only set these properties if
the user actually activates a particular sheet?)
Anyway, here's my main question: With this approach I am able to lock the
contents of all cells, but this does not lock embedded VBA widgets, e.g.
Checkboxes, Command Buttons, etc. How can I lock these objects as well?
Thanks for your help!
- Joe Geretz -
the active worksheet back to the first worksheet.
For Each WkSht In m_DocExcel.Worksheets
WkSht.Protect "mypassword", True, True, True, True
WkSht.Activate
m_AppExcel.ActiveWindow.DisplayGridlines = False
m_AppExcel.ActiveWindow.DisplayHeadings = False
Next WkSht
m_DocExcel.Worksheets(1).Activate
Is it possible to set protection on the entire workbook in one atomic
operation, or do I need to set the protection for each sheet separately, as
I am doing? And is there a more efficient way of setting the appearance
style for every worksheet or must I cycle through them individually as I am
doing? (I guess I could implement events and only set these properties if
the user actually activates a particular sheet?)
Anyway, here's my main question: With this approach I am able to lock the
contents of all cells, but this does not lock embedded VBA widgets, e.g.
Checkboxes, Command Buttons, etc. How can I lock these objects as well?
Thanks for your help!
- Joe Geretz -