I need help with this macro. Its purpose is to cycle through all the sheets in the workbook, protect all the cells in the sheet, protect the sheet and return to the original active cell.

I have put together part of the macro using the examples in Andrew Pitonyak's macro documents as well as the OOo forums as a base.


Sub ProtectAllSheets
Dim osheets as Object
Dim osheet as Object

osheet = thisComponent.sheets
for i = 0 to oSheet.count - 1
 oOldSeletion = ThisComponent.CurrentSelection  'Store the Active Cell
 osheet.getByIndex(i).unprotect("") 'unlock the sheet
 'Now protect all the cells in this sheet

Here I can't figure out what statements are required to protect all the cells in the sheet. Will someone 'please give me a clue. I've searched Andrew Pitonyak's and the OOo Forums but have not been able to 'find an answer.


 'Finished Protecting all the cells
 oSheet.getByIndex(i).protect("") 'lock the sheet
ThisComponent.CurrentController.Select(oOldSelection) 'Return to the starting cell of this sheet
next
End Sub

It would also help if in addition to the missing code above, Someone could tell me how to get the name of the current active sheet. That is for another project.

Thank you very much.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to