Protection of shapes on sheet

shawleigh17

Board Regular
Joined
Nov 16, 2007
Messages
79
Hi, I added the following code to my vba code for the workbook_open module. This code was generated using a macro recorder, but now it doesn't seem to work when I move the code to the open event.

Code:
Sheets("Layout_Manager").Select
    Sheets("Layout_Manager").Protection.AllowEditRanges.Add Title:="Layout_Manager_Edit", Range:= _
        Range("B4:BC100"), Password:="xxxxxxxx"
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

I get an application error. Any suggestions.
 
Last edited:

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hmmm... if you're using the Workbook_open event, try this:

Code:
Private Sub workbook_open()
Application.Goto "LayoutManager"
'the rest of your code here
End Sub

Select a cell - maybe A1 - in your worksheet named Layout Manager, and name it LayoutManager or something else you might like. You won't need to select the sheet, and you won't get the Application Error.

This should solve your problem. And, remember to put the code in the ThisWorkbook module.

Regards,
XLXRider
 
Upvote 0

Forum statistics

Threads
1,214,889
Messages
6,122,097
Members
449,065
Latest member
albertocarrillom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top