"Run-time error '-2147467259 (80004005)'" when you programmatically set a property of a chart in Excel

Applies to: Excel 2013Excel 2010Microsoft Office Excel 2007 More


Consider the following scenario:
  • You have a macro that sets a property of a chart in Microsoft Excel. For example, the macro sets the MaximumScale, MinimumScale, Title, Axis, or Legend property of a chart.
  • You protect the worksheet. When you do this, you click to select the Edit objects check box in the Protect Sheet dialog box.
  • You run the macro.

In this scenario, you receive an error message that resembles one of the following.

Error message 1
Run-time error '-2147467259 (80004005)':

Method 'MaximumScale' of object 'Axis' failed
Error message 2
Run-time error '-2147467259 (80004005)':

Automation error

Unspecified error


This problem occurs because the Excel object model for the chart is disabled on a protected worksheet.


To work around this problem, unprotect the worksheet to enable the macro to run. You can manually unprotect the worksheet or by using the Unprotect method in the macro.


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.