?
=?ISO-8859-1?Q?Bernard_Bour=E9e?=
I have the following code
Dim NomFichierImage As String
NomFichierImage = "Test" & ".gif"
Activechart.Export Filename:=NomFichierImage, FilterName:="GIF"
The last line give an Automation Error.
What is wrong ?
Bernard
===========================================
The Activechart existe . The full code is there:
Charts.Add
With ActiveChart
.ChartType = xlLineMarkers
For ir = 1 To nr
ReDim ValY(nv) As Double
ValY = GetValY(ValYs, ir)
.SeriesCollection.NewSeries
With .SeriesCollection(ir)
.Values = ValY
.XValues = ValX
.Name = LibY(ir)
End With
Next
.HasTitle = True
.ChartTitle.Characters.Text = Titre
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = LibAxeX
.Axes(xlValue, xlPrimary).HasTitle = False
'TODO Traiter le cas où les unités des Résultats ne sont pas
'au même format
.Axes(xlCategory).TickLabels.NumberFormat = FormatAxeY(1)
.Axes(xlValue).TickLabels.NumberFormat = FormatAxeX
.Location Where:=xlLocationAsObject, Name:="Graphiques"
'Sauvegarde du graphique
Dim NomFichierImage As String
Dim NomImage As String
NomFichierImage = ThisWorkbook.Path & "\" & Titre & ".gif"
NomFichierImage = "Test" & ".gif"
.Export Filename:=NomFichierImage, FilterName:="GIF"
Dim NomFichierImage As String
NomFichierImage = "Test" & ".gif"
Activechart.Export Filename:=NomFichierImage, FilterName:="GIF"
The last line give an Automation Error.
What is wrong ?
Bernard
===========================================
The Activechart existe . The full code is there:
Charts.Add
With ActiveChart
.ChartType = xlLineMarkers
For ir = 1 To nr
ReDim ValY(nv) As Double
ValY = GetValY(ValYs, ir)
.SeriesCollection.NewSeries
With .SeriesCollection(ir)
.Values = ValY
.XValues = ValX
.Name = LibY(ir)
End With
Next
.HasTitle = True
.ChartTitle.Characters.Text = Titre
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = LibAxeX
.Axes(xlValue, xlPrimary).HasTitle = False
'TODO Traiter le cas où les unités des Résultats ne sont pas
'au même format
.Axes(xlCategory).TickLabels.NumberFormat = FormatAxeY(1)
.Axes(xlValue).TickLabels.NumberFormat = FormatAxeX
.Location Where:=xlLocationAsObject, Name:="Graphiques"
'Sauvegarde du graphique
Dim NomFichierImage As String
Dim NomImage As String
NomFichierImage = ThisWorkbook.Path & "\" & Titre & ".gif"
NomFichierImage = "Test" & ".gif"
.Export Filename:=NomFichierImage, FilterName:="GIF"