Hi below is some code ive written which shoudl give you some idea on the coding behin ms excel chart
Public Function pfunCreatEGraphs(chkd(), chkID) As String
Dim i As Integer
Dim WrkApp As Excel.Application
Dim Wrkbknew As Workbook
Dim WrkShtNew As Worksheet
Dim StrSql As String
Dim Rst As Recordset
Dim FlDcO(3) As String
Dim LpC As Integer
Dim intco As Integer
Dim IntcoL As String
Dim ChtNew As Chart
Dim strb, strc As String
'On Error GoTo ErrTrap
'-------------------Excel Add----------------
Set WrkApp = CreateObject("Excel.application"

Set Wrkbknew = WrkApp.Workbooks.Add
'Wrkbknew.Application.Visible = True
'----------****************** LOOP ***************************
LpC = 1
i = 1
Do Until LpC = UBound(chkd) + 1
Set WrkShtNew = Wrkbknew.Worksheets.Add
WrkShtNew.Name = chkd(LpC)
'--****-----Call Functions for SQL
StrSql = pfunWhAtSqL(chkd(LpC), chkID)
FlDcO(1) = pfunWhAtcolumns(chkd(LpC), 1)
FlDcO(2) = pfunWhAtcolumns(chkd(LpC), 2)
FlDcO(3) = pfunWhAtcolumns(chkd(LpC), 3)
intco = pfunHowmanycolumns(chkd(LpC))
'--****----------------------------
'---** Connect TO Data **------------------
psubUserConnect
Set Rst = objUserConnection.Execute(StrSql)
'--**POPULATE NEW SHEET WITH DATA FROM RST **____________
Do Until Rst.EOF = True
Select Case intco
Case 1
Wrkbknew.Sheets(chkd(LpC)).Cells(i, 1) = Rst.Fields(2)
Wrkbknew.Sheets(chkd(LpC)).Cells(i, 2) = 0 + Rst.Fields(FlDcO(1))
i = i + 1
IntcoL = "B"
Case 2
Wrkbknew.Sheets(chkd(LpC)).Cells(i, 1) = Rst.Fields(2)
Wrkbknew.Sheets(chkd(LpC)).Cells(i, 2) = 0 + Rst.Fields(FlDcO(1))
Wrkbknew.Sheets(chkd(LpC)).Cells(i, 3) = 0 + Rst.Fields(FlDcO(2))
i = i + 1
IntcoL = "C"
Case 3
Wrkbknew.Sheets(chkd(LpC)).Cells(i, 1) = Rst.Fields(2)
Wrkbknew.Sheets(chkd(LpC)).Cells(i, 2) = 0 + Rst.Fields(FlDcO(1))
Wrkbknew.Sheets(chkd(LpC)).Cells(i, 3) = 0 + Rst.Fields(FlDcO(2))
Wrkbknew.Sheets(chkd(LpC)).Cells(i, 4) = 0 + Rst.Fields(FlDcO(3))
i = i + 1
IntcoL = "D"
End Select
Rst.MoveNext
Loop
'------------------
'**** CREATE CHART ****----------------
If i > 1 Then
Set ChtNew = Wrkbknew.Charts.Add
strc = "A1:" & IntcoL & i - 1
With ChtNew
.ChartType = xlColumnClustered
.SetSourceData Source:=Sheets(chkd(LpC)).Range(strc), PlotBy:=xlColumns
.Location WHERE:=xlLocationAsObject, Name:=chkd(LpC)
End With
End If
'----********** Clear Up
Set WrkShtNew = Nothing
Set ChtNew = Nothing
StrSql = ""
intco = 0
strb = ""
strc = ""
i = 1
psubUserDisconnect
'=--------Loop counter increase
LpC = LpC + 1
Loop
Dim FilNm As String
Dim rndIn As Integer
Randomize
rndIn = Int((20 * Rnd) + 1)
FilNm = "C:\temp\da" & rndIn & ".xls"
Wrkbknew.SaveAs FileName:=FilNm
Wrkbknew.Close
WrkApp.Quit
Set ChtNew = Nothing
Set WrkShtNew = Nothing
Set WrkApp = Nothing
StrSql = ""
intco = 0
strb = ""
strc = ""
psubUserDisconnect
pfunCreatEGraphs = FilNm
Exit Function
End Function
Public Function GetdatAfromExcel(pPf As Presentation, chkd(), flPath As String)
Dim Wrkbk As Workbook
Dim WrkSht As Worksheet
Dim ChtEx As Chart
Dim Pnew As Slide
Dim Y As Integer
Dim fntSz As Integer
'-------------Dims for frmt
Dim a, b As String
Dim C As Integer
'***************************************************
Set Wrkbk = GetObject(flPath)
'****************For next loop to move through the worksheets
For Each WrkSht In Wrkbk.Worksheets
Set a = WrkSht.Cells.SpecialCells(xlCellTypeLastCell)
C = a.Row
Debug.Print C & " TH"
'***********************FONT SIZE FOR AXIS
If C > 110 Then
fntSz = 6
Else
fntSz = 8
End If
'*********************
b = a.Address(ReferenceStyle:=xlR1C1)
b = Left(b, Len(b) - 1)
b = b & "1"
b = "R1C1:" & b ' range for labels
'******* Test for charts
If WrkSht.ChartObjects.Count > 0 Then
'with Chart
With WrkSht.ChartObjects(1).Chart 'anything to do with chart straight
.HasLegend = False
.ChartArea.Border.LineStyle = 0
.PlotArea.Interior.ColorIndex = xlNone
.PlotArea.Border.LineStyle = xlNone
.SeriesCollection(1).XValues = "='" & WrkSht.Name & "'!" & b & ""
.SeriesCollection(1).Interior.ColorIndex = 37
With .Axes(xlCategory)
.HasTitle = False
.TickLabelSpacing = 1
' .MajorUnit = XScUni 'look here
With .TickLabels
' .TickLabelSpacing = 1
.AutoScaleFont = False
.Alignment = xlCenter
.Offset = 100
.Orientation = xlUpward
With .Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
End With
End With
'*******************************
With .Axes(xlValue)
.HasTitle = True
.AxisTitle.Text = pfunWhatAxislabel(WrkSht.Name)
.HasMajorGridlines = False
.HasMinorGridlines = False
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
.MaximumScaleIsAuto = True
With .TickLabels
.AutoScaleFont = False
With .Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = fntSz
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
End With
End With
End With
With WrkSht.ChartObjects(1)
.Height = 349
.Width = 780
.Chart.ChartGroups(1).GapWidth = 50
Select Case .Chart.SeriesCollection.Count
Case 2
.Chart.SeriesCollection(2).Interior.ColorIndex = 1
.Chart.HasLegend = True
.Chart.Legend.Position = xlTop
.Chart.Legend.Font.Size = 8
.Chart.SeriesCollection(1).Name = "Initial Weight"
.Chart.SeriesCollection(2).Name = "Optimised Weight"
Case 3
.Chart.SeriesCollection(2).Interior.ColorIndex = 1
.Chart.ChartGroups(1).Overlap = 100
.Chart.SeriesCollection(3).AxisGroup = 2
.Chart.SeriesCollection(3).ChartType = xlLine
.Chart.SeriesCollection(3).Border.ColorIndex = 3
.Chart.Axes(xlValue, xlSecondary).TickLabels.Font.Size = 8
.Chart.HasLegend = True
.Chart.Legend.Position = xlTop
.Chart.Legend.Font.Size = 8
.Chart.SeriesCollection(1).Name = "Stand Alone"
.Chart.SeriesCollection(2).Name = "Diversified"
.Chart.SeriesCollection(3).Name = "Diversity Score"
End Select
End With
WrkSht.ChartObjects(1).CopyPicture
'***************************************************************
x = pPf.Slides.Count + 1
Set Pnew = pPf.Slides.Add(x, ppLayoutTitle)
Pnew.Shapes.Title.TextFrame.TextRange.Text = WrkSht.Name
Pnew.Shapes.Paste
With Pnew.Shapes("Rectangle 2"

.Height = 36
.Width = 692
.Left = 41
.Top = 18
.TextFrame.TextRange.Font.Size = 24
.TextFrame.TextRange.Font.Name = "ARIAL"
.TextFrame.TextRange.Font.Bold = msoCTrue
End With
Pnew.Shapes(2).Delete
With Pnew.Shapes(2)
.Height = 349
.Width = 780
.Left = 0
.Top = 108
End With
Pnew.Name = WrkSht.Name
End If
Next
Wrkbk.Save
Wrkbk.Close
End Function