Skip to Main Content
Excel 2003 VBA Programmer's Reference
book

Excel 2003 VBA Programmer's Reference

by Paul T. Kimmel, Stephen Bullen, John Green, Rob Bovey, Robert Rosenberg
July 2004
Beginner content levelBeginner
1176 pages
27h 45m
English
Wrox
Content preview from Excel 2003 VBA Programmer's Reference

24

Generating Charts

In this chapter we will see how you can use the macro recorder to discover what objects, methods, and properties are required to manipulate charts. We will then improve and extend that code to make it more flexible and efficient. This chapter is designed to show you how to gain access to Chart objects in VBA code so that you can start to program the vast number of objects that Excel charts contain. You can find more information on these objects in Appendix A. We will look specifically at:

  • Creating Chart objects on separate sheets
  • Creating Chart objects embedded in a worksheet
  • Editing data series in charts
  • Defining series with arrays
  • Defining chart labels linked to worksheet cells

You can create two types of charts in Excel: charts that occupy their own chart sheets and charts that are embedded in a worksheet. They can be manipulated in code in much the same way. The only difference is that, while the chart sheet is a Chart object in its own right, the chart embedded in a worksheet is contained by a ChartObject object. Each ChartObject on a worksheet is a member of the worksheet's ChartObjects collection. Chart sheets are members of the workbook's Charts collection.

Each ChartObject is a member of the Shapes collection, as well as a member of the ChartObjects collection. The Shapes collection provides you with an alternative way to refer to embedded charts. The macro recorder generates code that uses the Shapes collection rather than the ChartObjects collection ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Excel 2007 VBA Programming with XML and ASP

Excel 2007 VBA Programming with XML and ASP

Julitta Korol
Microsoft® Office Excel 2003 Programming Inside Out

Microsoft® Office Excel 2003 Programming Inside Out

Curtis Frye, Wayne S. Freeze, Felicia K. Buckingham
Excel® 2007 VBA Programmer's Reference

Excel® 2007 VBA Programmer's Reference

John Green, Stephen Bullen, Rob Bovey, Michael Alexander
Access™ 2007 VBA Programmer's Reference

Access™ 2007 VBA Programmer's Reference

Teresa Hennig, Rob Cooper, Geoffrey Griffith, Armen Stein

Publisher Resources

ISBN: 9780764556609Purchase book