Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Modifying an Excel Chart in VB - DOM question

I've got a VB6 app that modifies a worksheet that a few charts use for their data. When I recreate the worksheet, the series for the charts are all out of whack, and I need to recreate them.

I've been able to find scant information on programmatically modifying chart series information (using VB6). Here's what I know so far:

1) The total # of series in the chart
chtChart.SeriesCollection.Count

2) set the name of the chart in the legend
chtChart.SeriesCollection(i).Name

3) set the range of the series in the chart
chtChart.SeriesCollection(i).values = <some range

I need to know the following:

1) How do I specify how the data is displayed (i.e. as a vertical bar or as a data point connected by a (roughly) horizontal line)

2) How do I specify the color of the displayed data bar/line

3) How do I specify the pattern of the displayed data line (i.e. It has a triangle on it, it has a circle on it, etc...)

I hope that this makes sense and that this is the correct forum to post this in.

Thanks for any help you can offer,

Paul Willman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Modifying an Excel Chart in VB - DOM question

Paul -

I assume you have access to Excel. The easiest way to explore the object
model is to do what you want your code to do, manually, with the macro
recorder running. Sometimes the code it gives you isn't very well
optimized; it records every click and every object you select. But at
least you get the syntax and key words. The Object Browser in Excel's
VBE can fill in the gaps.

The type of chart is given by the ChartType property of the Chart class.
For example:

ActiveChart.ChartType = xlColumnClustered

(a vertical bar chart is called a column chart in Excel).

In a line or scatter chart, you can specify the .MarkerStyle of the
Series object:

ActiveChart.SeriesCollection(1).MarkerStyle = xlDiamond

In addition to Excel's tools (macro recorder and object browser), you
could check out some pages on my web site. This is a good place to start:

http://peltiertech.com/Excel/ChartsH...kChartVBA.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Paul Willman wrote:

I've got a VB6 app that modifies a worksheet that a few charts use
for their data. When I recreate the worksheet, the series for the
charts are all out of whack, and I need to recreate them.

I've been able to find scant information on programmatically
modifying chart series information (using VB6). Here's what I know
so far:

1) The total # of series in the chart chtChart.SeriesCollection.Count


2) set the name of the chart in the legend
chtChart.SeriesCollection(i).Name

3) set the range of the series in the chart
chtChart.SeriesCollection(i).values = <some range

I need to know the following:

1) How do I specify how the data is displayed (i.e. as a vertical bar
or as a data point connected by a (roughly) horizontal line)

2) How do I specify the color of the displayed data bar/line

3) How do I specify the pattern of the displayed data line (i.e. It
has a triangle on it, it has a circle on it, etc...)

I hope that this makes sense and that this is the correct forum to
post this in.

Thanks for any help you can offer,

Paul Willman


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Modifying an Excel Chart in VB - DOM question

Thanks Jon,

Great advice and a useful site - I'm up and moving again!

Paul

"Jon Peltier" wrote:

Paul -

I assume you have access to Excel. The easiest way to explore the object
model is to do what you want your code to do, manually, with the macro
recorder running. Sometimes the code it gives you isn't very well
optimized; it records every click and every object you select. But at
least you get the syntax and key words. The Object Browser in Excel's
VBE can fill in the gaps.

The type of chart is given by the ChartType property of the Chart class.
For example:

ActiveChart.ChartType = xlColumnClustered

(a vertical bar chart is called a column chart in Excel).

In a line or scatter chart, you can specify the .MarkerStyle of the
Series object:

ActiveChart.SeriesCollection(1).MarkerStyle = xlDiamond

In addition to Excel's tools (macro recorder and object browser), you
could check out some pages on my web site. This is a good place to start:

http://peltiertech.com/Excel/ChartsH...kChartVBA.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Paul Willman wrote:

I've got a VB6 app that modifies a worksheet that a few charts use
for their data. When I recreate the worksheet, the series for the
charts are all out of whack, and I need to recreate them.

I've been able to find scant information on programmatically
modifying chart series information (using VB6). Here's what I know
so far:

1) The total # of series in the chart chtChart.SeriesCollection.Count


2) set the name of the chart in the legend
chtChart.SeriesCollection(i).Name

3) set the range of the series in the chart
chtChart.SeriesCollection(i).values = <some range

I need to know the following:

1) How do I specify how the data is displayed (i.e. as a vertical bar
or as a data point connected by a (roughly) horizontal line)

2) How do I specify the color of the displayed data bar/line

3) How do I specify the pattern of the displayed data line (i.e. It
has a triangle on it, it has a circle on it, etc...)

I hope that this makes sense and that this is the correct forum to
post this in.

Thanks for any help you can offer,

Paul Willman



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about modifying dates marf Excel Discussion (Misc queries) 3 October 1st 08 10:35 PM
Modifying a Chart Object Name pauloreiss Excel Discussion (Misc queries) 5 December 21st 05 07:59 PM
Modifying a Chart Object Name pauloreiss Excel Discussion (Misc queries) 0 December 21st 05 05:43 PM
Modifying a Formula / OR Question carl Excel Worksheet Functions 3 September 19th 05 08:15 PM
Modifying text in Chart Tips Ashley[_3_] Excel Programming 1 January 5th 04 05:57 PM


All times are GMT +1. The time now is 08:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"