Protecting Charts in Microsoft ExcelProtecting a Chart SheetA chart sheet can be protected manually by selecting Protection from the Tools menu, then choosing Protect Sheet. Any combination of two options may be selected:
The VBA equivalent of this manual sheet protection is: ActiveChart.Protect Password:="drowssap", DrawingObjects:=True, Contents:=True Note: despite being protected, the chart sheet may still be deleted. Protecting a Chart Embedded in a WorksheetAn embedded chart can be protected manually by selecting Protection from the Tools menu, then choosing Protect Sheet. The Protect Worksheet for Objects option must be selected to protect the chart. This command prevents selection of the chart, and therefore it cannot be changed. If there are changes to worksheet data that the chart is linked to, the chart will update. Protecting the sheet will only protect the chart if its parent chart object is locked (which is the default for an object). To change the Locked status of the chart, hold the Shift key while clicking on the chart to select the chart object. Selecting the chart object displays white handles (small resizing squares around the chart) rather than black handles. Select Object from the Format menu, click on the Protection tab, and check or uncheck the Locked checkbox. The VBA equivalent of this manual sheet protection is: ActiveSheet.Protect Password:="drowssap", DrawingObjects:=True Selectively Protecting a Chart Using VBAThere are several protection-related properties of a chart which can be adjusted in VBA. These work the same way on chart sheets and on embedded charts. For these selective protection schemes to work, the sheet containing the chart must be unprotected, or the chart itself must be unlocked if the sheet is protected.
|
Peltier Technical Services, Inc.Excel Chart Add-Ins | Training | Charts and Tutorials | PTS BlogPeltier Technical Services, Inc., Copyright © 2017. All rights reserved. |