titres des axes d'un graphique dans vba
Bonjour,
en utilisant vba, je construis un graphe sur base de données reprises dans un tableau. Je souhaite nommer les axes de mon graphe. N'etant pas un expert en vba, j'enregistre tout simplement une macro, je fais les manipulations nécessaires et je colle ensuite le bout de code produit à l'ensemble de mon code. Seulement voila, il y a un problème et je ne comprends pas d'ou il vient... Le problème survient dans le code suivant :
Code:
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 67 68 69 70 71 72 73
| ActiveChart.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
With Selection.Format.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
.Solid
End With
Selection.Format.TextFrame2.TextRange.Font.Size = 16
' PROBLEME A LA LIGNE QUI SUIT
ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Text = "STANDARD DEVIATION"
Selection.Format.TextFrame2.TextRange.Characters.Text = "STANDARD DEVIATION"
With Selection.Format.TextFrame2.TextRange.Characters(1, 15).ParagraphFormat
.TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter
End With
With Selection.Format.TextFrame2.TextRange.Characters(1, 15).Font
.BaselineOffset = 0
.Bold = msoTrue
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.Fill.ForeColor.TintAndShade = 0
.Fill.ForeColor.Brightness = 0
.Fill.Transparency = 0
.Fill.Solid
.Size = 16
.Italic = msoFalse
.Kerning = 12
.Name = "+mn-lt"
.UnderlineStyle = msoNoUnderline
.Strike = msoNoStrike
End With
ActiveChart.ChartArea.Select
ActiveChart.SetElement (msoElementPrimaryValueAxisTitleRotated)
With Selection.Format.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
.Solid
End With
Selection.Format.TextFrame2.TextRange.Font.Size = 16
ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Text = "EXPECTED RETURN"
Selection.Format.TextFrame2.TextRange.Characters.Text = "EXPECTED RETURN"
With Selection.Format.TextFrame2.TextRange.Characters(1, 18).ParagraphFormat
.TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter
End With
With Selection.Format.TextFrame2.TextRange.Characters(1, 18).Font
.BaselineOffset = 0
.Bold = msoTrue
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.Fill.ForeColor.TintAndShade = 0
.Fill.ForeColor.Brightness = 0
.Fill.Transparency = 0
.Fill.Solid
.Size = 16
.Italic = msoFalse
.Kerning = 12
.Name = "+mn-lt"
.UnderlineStyle = msoNoUnderline
.Strike = msoNoStrike
End With |