RunTime Error 1004 when setting a series' error bars in Excel 2007

S

Steve Tummey

I am trying to modify the ErrorBars property of a series on a Box and Whisker
chart made up of stacked bar charts in Excel 2007 using the following code:

..SeriesCollection(strLQ_DATA_SERIES_NAME).ErrorBar xlY, _
xlErrorBarIncludeMinusValues, _
xlErrorBarTypeCustom, "", rngWhiskerBottom

where rngWhiskerBottom is a range object contains the cell locations of the
error values (negative only ones in this specific case).

When executing this code in Excel 2007 you get an RunTime Error 1004:
Application or Object defined error but it executes fine in Excel 2000 and
2002.

The error bar for this series already exists as what I do is have template
of the chart on 1 worksheet, copy it into the destination sheet and then
modify the various data ranges that make up the chart data based on user
defined inputs. It is only setting the ErrorBars property that fails.

I'm at a loss as to why this would occur as the above piece of code looks
fine to me and should do what I expect.

Has anyone come across a solution, or workaround, to this or a similar
problem or provide any clue as to why it would only fail in Excel 2007 and
not previous versions when as far as I can tell there has been no change to
the object model for adding ErrorBars to a series.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top