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

Symptoms
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

Cause
This problem occurs because the Excel object model for the chart is disabled on a protected worksheet.
Workaround
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.
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

XL2013 XL2010 XL2007 Excel2013 Excel2010 Excel2007

Properties

Article ID: 983119 - Last Review: 09/23/2015 07:48:00 - Revision: 5.0

Microsoft Excel 2013, Microsoft Excel 2010, Microsoft Office Excel 2007, Excel 2016

  • kbsurveynew kbprb kbexpertiseinter kberrmsg KB983119
Feedback