Chart

G

gr

Hi, I'm using automation to send data to excel and build a
chart.

The chart is working but I can't find the way to give
format to it. I found this code, but when running this
error displays:

"Error 1004: Method chart wizard of object chart failed"

The code looks like this:

....... more code......
........................
'formatting chart
With gobjExcel
.Range("A4").Select
.ActiveCell.CurrentRegion.Select
Set rng = .Selection
rng.NumberFormat = "#, ##0.000"
rng.EntireColumn.AutoFit
'Add a chart object
If (intNo = 1) Then
'Nominal Data chart
.Range("C4:F17").Select
Set rng = .Selection
.Charts.Add
'THESE LINES BELOW SEEM TO BE WRONG
.ActiveChart.ChartWizard Source:=Range(rng.Address),
Gallery:=xlColumn, _ Format:=6, PlotBy:=xlColumns,
CategoryLabels:=1, SeriesLabels:=1, _ HasLegend:=1,
Title:="Nominal Data", CategoryTitle:=" ", _
ValueTitle:=" ", ExtraTitle:=" "

ElseIf (intNo = 2) Then
'VMS Readings chart
............more code...........
...............


Can someone tell my why is wrong? Or guide me in how
formatting the chart from Access (Title, Axes Labels, etc)

Regards,
gr
 
Top