Microsoft KB Archive/112176

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 11:22, 20 July 2020 by X010 (talk | contribs) (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

XL5: Cannot Set Chart Data Marker Color Using Macro



The information in this article applies to:


  • Microsoft Excel for Windows, version 5.0





SYMPTOMS

In Microsoft Excel, when the background or foreground color of a chart data marker is set to none, you cannot change the color of that data marker with a macro.



STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel for Windows version 5.0c.



WORKAROUND

To set the color of a chart data marker using a macro, when the color of the chart marker is set to none, use the ClearFormats method in a Visual Basic procedure, or the Clear function in a Microsoft Excel version 4.0 macro as in the following examples:

Visual Basic Examples

   ' Set Series 1 data marker background color to red
   Charts(1).SeriesCollection(1).ClearFormats
   Charts(1).SeriesCollection(1).MarkerBackgroundColorIndex = 3

   ' Set Series 1 data markers foreground color to red
   Charts(1).SeriesCollection(1).ClearFormats
   Charts(1).SeriesCollection(1).MarkerForegroundColorIndex = 3 

Microsoft Excel version 4.0 Examples

The following example clears the Series 1 data marker formatting on the active chart, and sets the background color to red:

   =SELECT("S1")
   =CLEAR(2)
   =PATTERNS(,,,,0,,,3,,) 

The following example clears the Series 1 data marker formatting on the active chart, and sets the foreground color to red:

   =SELECT("S1")
   =CLEAR(2)
   =PATTERNS(,,,,0,,3,,,) 

Note that when you use the above examples, the drawback of using the ClearFormats method and the Clear function is that all the formatting for the selected data markers is reset. Because of this resetting, you must set all formatting for the selected data markers after using either command.

Microsoft provides examples of Visual Basic 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. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose. Note that a line that is preceded by an apostrophe introduces a comment in the code--comments are provided to explain what the code is doing at a particular point in the procedure. Note also that an underscore character (_) indicates that code continues from one line to the next. You can type lines that contain this character as one logical line or you can divide the lines of code and include the line continuation character. For more information about Visual Basic for Applications programming style, see the "Programming Style in This Manual" section in the "Document Conventions" section of the "Visual Basic User's Guide."

Microsoft provides macro examples 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. This macro is provided as is and Microsoft in no way guaranties that the following code can be used in all situations and will not support modifications of the code to suit specific customer requirements.



REFERENCES

For more information about Formatting Data Markers, choose the Search button in Help and type:

chart data markers

Additional query words:

Keywords :
Version : 5.00
Platform : WINDOWS
Issue type :
Technology :


Last Reviewed: September 16, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.