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
| Option Explicit
Option Base 1
'Nota:
'Utilisez l'objet WCChart pour la bibliothèque OWC9.
'Dim Cht As WCChart
'Bibliothèques OWC10 et OWC11
Dim Cht As ChChart
Dim C
Private Sub UserForm_Initialize()
'Spécifie la source de données pour le graphique
ChartSpace1.DataSource = Spreadsheet1
Set C = ChartSpace1.Constants
'Ajoute le graphique
Set Cht = ChartSpace1.Charts.Add
'Définit le type de graphiUE
Cht.Type = C.chChartTypeLine
End Sub
Private Sub CommandButton1_Click()
'Intègre les données du SpreadSheet dans le controle ChartSpace
Cht.SetSpreadsheetData "Sheet1!A1:B5", False
End Sub |
Partager