Access to Excel Automation : problem with Category X Axis

G

Gustav

Good afternoon,

This is my first post so apologies if i don't observe any etiquette.

I'm coding Access to Excel to create an xls file with a sheet
offigures and a chart embedded on the sheet.

I've got most everything going fine BUT I can't get the X CategoryAxis
set up on the chart.

Any suggestions will be most appreciated.

Here's the code: 'Create the first Chart - month to month figures
Dim chart1 As ChartObject Set chart1 =
xlSheet.ChartObjects.Add(10, 200, 920, 300)
chart1.Chart.chartwizard _ Source:=xlSheet.Range("D3:e14"), _
Gallery:=xl3DColumn, _ Serieslabels:=0, _ PlotBy:=xlColumns,
_ Title:=Me![Combo3] & Chr(10) & "Month-to-Month" With
xlSheet.ChartObjects(1).Chart
xlSheet.ChartObjects(1).Chart.HasDataTable = True
xlSheet.ChartObjects(1).Chart.DataTable.HasBorderHorizontal
=True xlSheet.ChartObjects(1).Chart.DataTable.HasBorderVertical
=True xlSheet.ChartObjects(1).Chart.DataTable.HasBorderOutline
=True xlSheet.ChartObjects(1).Chart.SeriesCollection(1).Name
="Achieved"
xlSheet.ChartObjects(1).Chart.SeriesCollection(2).Name ="Target"
xlSheet.ChartObjects(1).Chart.Axes(xlCategory, xlPrimary).Range
="c3:c14" ---> this doesn't work and has been trial-and-error-hit-and-
miss approach to finding a solution. Thanks very much, gustav
 
G

Guest

The RANGE property applies to the DATASHEET object. Instead, take a look at
the properties MINIMUMSCALE and MAXIMUMSCALE.

Chart.Axes(xlCategory).MinimumScale = 0
Chart.Axes(xlCategory).MaximumScale = 100

BrerGoose
 
G

Gustav

The RANGE property applies to the DATASHEET object. Instead, take a look at
the properties MINIMUMSCALE and MAXIMUMSCALE.

Chart.Axes(xlCategory).MinimumScale = 0
Chart.Axes(xlCategory).MaximumScale = 100

BrerGoose

Hi BrerGoose,

Thanks alot for the feedback. I do appreciate it. I stumbled upon
the solution that i needed to work today :

xlSheet.ChartObjects(2).Chart.SeriesCollection(1).XValues =
xlSheet.Range("c3:c14")

Once again, thanks alot for getting back to me.

Kind regards,

Gustav
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top