Microsoft Knowledge Base |
|
XL: ErrorBar Method Fails Adding Negative Custom Error |
|
|
Last reviewed: September 13, 1996
Article ID: Q117174 |
|
The information in this article applies to:
SYMPTOMSIn Microsoft Excel, when you run a Visual Basic macro that uses the ErrorBar method to add error bars to a series on a chart, you receive the following error message when you run the macro:
Run-time error '1004': ErrorBar method of Series class failed CAUSEThis error occurs when the macro uses the ErrorBar method to add only a negative custom error amount to a selected series, and the Amount argument is missing. Note that when you turn on the macro recorder, and you use the Format Data Series dialog box to add only a negative custom error amount to a chart series, the recorded macro is missing the Amount argument and returns the error message above when you run the macro. The Amount argument should be optional for the ErrorBar method, as the Visual Basic Reference indicates. The argument is used for the positive error amount when you use a custom error amount. However, the argument is required if you want to avoid receiving the error message above, even if the value is empty when you use the ErrorBar method to add a negative custom error amount.
WORKAROUNDTo avoid receiving this error message when you use the ErrorBar method to add only a custom minus error bar to a chart series, add the following argument to the ErrorBar method command in your macro:
Amount:=""For example, to add a custom minus error bar with the value 3 to series four on the active chart, use the following command:
ActiveChart.SeriesCollection(4).ErrorBar Direction:=xlY, Include:= _
xlMinusValues, Type:=xlCustom, MinusValues:="={3}", Amount:=""
Note that if you turn on the macro recorder, and you use the Error
Bars dialog box to add only a negative custom error amount to a chart
series, the recorded macro contains the Amount argument, and you do
not receive the error message when you run the macro.
Microsoft provides examples of Visual Basic for Applications procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
REFERENCESFor more information about the ErrorBar Method, choose the Search button in the Visual Basic Reference and type:
ErrorBar Method |
|
KBCategory: kbdocerr
©1997 Microsoft Corporation. All rights reserved. Legal Notices. |