Acces to Excel automation : chart problem - Category X Axis

G

gustavswanepoel

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 of
figures and a chart embedded on the sheet.

I've got most everything going fine BUT I can't get the X Category
Axis set up on the graph.

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
 

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