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 chemin As String ' chemin du fichier
Dim nomfichier As String ' nom du fichier
Dim xl As Excel.Application ' application excel
Dim xlsClass As Excel.Workbook ' classeur excel
Dim xlsFeuille As Excel.Worksheet ' feuille excel
Dim colonne As Integer
Sub TraiterDonnees_Clic()
' ouverture du fichier de mesures
Set xl = CreateObject("Excel.Application")
On Error Resume Next
chemin = xl.GetOpenFilename
xl.Workbooks.OpenText (chemin)
' récupération du nom du fichier
Dim TabSplit() As String
TabSplit = Split(chemin, "\")
nomfichier = TabSplit(UBound(TabSplit))
'affichage du résultat
xl.Visible = True
' dépouillement d'un essai puissance
Call depouille_un_essai_puissance
On Error GoTo 0
End Sub
Private Sub depouille_un_essai_puissance()
Call Depouillement
Call SousEchantillonnage
Call miseenforme
For n = 4 To colonne
Call graphique(n)
Next n
End Sub
Private Sub graphique(ByVal numCol As Integer)
'
With xl
Dim maSelection As String
maSelection = "C:C," & Chr(Asc("A") + (numCol - 1)) & ":" & Chr(Asc("A") + (numCol - 1))
duree = 1.2 * .Cells(4, 4).Value
titre = .ActiveSheet.Name
.Range(maSelection).Select
'.Columns(selection).Select
.Charts.Add
.ActiveChart.ChartType = xlXYScatterSmooth
.ActiveChart.SetSourceData Source:=.Sheets(titre).Range(maSelection), PlotBy:=xlColumns
.ActiveChart.Location Where:=xlLocationAsObject, Name:=titre
With .ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = titre
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Temps(S)"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Puissance kW)"
End With
End With
End Sub |