1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
Dim xlApp As Excel.Application
Dim xlSheet As Excel.Worksheet
Dim xlBook As Excel.Workbook
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
'requetes sql + tableaux à partir des recordset
Set xlSheet = xlBook.Worksheets.Add
xlSheet.Name = "Exemple"
'PUIS LA PARTIE QUE GENERE L ERREUR
Set Grf = xlSheet.ChartObjects.Add(400, 10, 360, 214)
With Grf.Chart
.ChartType = xlBarClustered
.SeriesCollection.NewSeries
With .SeriesCollection(1)
.Values = xlSheet.Range(lettre1 & "5:" & lettre1 & "13")
.XValues = xlSheet.Range("A5:A13")
End With
.HasLegend = False
.Parent.Name = nomGraph1
.Axes(xlValue).MajorUnit = 1
.Axes(xlValue).MaximumScale = 10
With .Axes(xlCategory).TickLabels.Font
.Name = "Corbel"
.Size = 10
End With
With .Axes(xlValue).TickLabels.Font
.Name = "Corbel"
.Size = 10
End With
End With
'BARRES
Grf.Chart.SeriesCollection(1).Select
With Selection.Format.Fill
.TwoColorGradient 2, 1
.ForeColor.RGB = RGB(250, 192, 144)
.BackColor.RGB = RGB(224, 84, 48)
End With
'FOND DEGRADE GRIS
Grf.Chart.PlotArea.Select
With Selection.Format.Fill
.TwoColorGradient 2, 1
.ForeColor.RGB = RGB(217, 217, 217)
.BackColor.RGB = RGB(255, 255, 255)
.GradientStops.Insert RGB(217, 217, 217), 0.6
.GradientStops.Insert RGB(255, 255, 255), 0.73
End With
'Trait au niveau du 7
Grf.Chart.PlotArea.Select
Grf.Chart.Shapes.AddConnector(1, 288, 1, 288, 190).Select
Selection.ShapeRange.ShapeStyle = 10008
'Trait au niveau du 8
Grf.Chart.PlotArea.Select
Grf.Chart.Shapes.AddConnector(1, 306, 1, 306, 190).Select
Selection.ShapeRange.ShapeStyle = 10008
'Pas de bordures
ActiveSheet.Shapes(nomGraph1).Line.Visible = 0
Set Grf = Nothing
xlApp.Visible = True |
Partager