UncleBajubjubs
Board Regular
- Joined
- Jul 11, 2017
- Messages
- 111
- Office Version
- 2010
Hello, I have a workbook with a a button, which I want to lock everything and delete the button. The following is the code:
<code>
Sub LockEverythingAndDeleteTheButton()
Application.CutCopyMode = False 'clears clipboard
ActiveSheet.Shapes.Range(Array("Rectangle 1")).Select 'selects export button
Selection.Delete 'deletes export button
ActiveSheet.Protect Password:="PASSWORD"
ActiveWorkbook.Protect Password:="PASSWORD", Structure:=True, Windows:=False 'lock the page
End Sub
</code>
The line that doesn't work is
<code>
Selection.Delete 'deletes export button
</code>
Any ideas as to why? Thank you.
<code>
Sub LockEverythingAndDeleteTheButton()
Application.CutCopyMode = False 'clears clipboard
ActiveSheet.Shapes.Range(Array("Rectangle 1")).Select 'selects export button
Selection.Delete 'deletes export button
ActiveSheet.Protect Password:="PASSWORD"
ActiveWorkbook.Protect Password:="PASSWORD", Structure:=True, Windows:=False 'lock the page
End Sub
</code>
The line that doesn't work is
<code>
Selection.Delete 'deletes export button
</code>
Any ideas as to why? Thank you.