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
| Private Sub Command11_Click()
Dim FSO: Set FSO = CreateObject("Scripting.FileSystemObject")
Dim waExcel: Set waExcel = CreateObject("Excel.Application") 'Ouverture d'Excel
'Ajoute \ à la fin s'il y en a pas
If Right(chemin, 1) <> "\" Then chemin = chemin & "\"
'Existance du fichier
If FSO.FileExists(chemin & Label3(0).Caption) Then
'Rendre invisible Excel
waExcel.Visible = False
'Importe le fichier texte vers une feuille Excel de façon Largeur fixe avec délimiteur : Tabulation et Space
waExcel.Workbooks.OpenText chemin & Label3(0).Caption, True, True, True, True, True, True, True, True, True, True ', ":"
'sélectionne l'aplication ouverte
Set Sheet = waExcel.ActiveWorkbook.ActiveSheet
Application.AlertBeforeOverwriting = False
'enlève les alertes de fermeture sans enregistrement
Application.DisplayAlerts = False
'récupérer des donner excel
square = Sheet.Application.ActiveSheet.Cells(52, 60).Value 'lie la celule
circularity = Sheet.Application.ActiveSheet.Cells(20, 55).Value 'lie la celule
Label6.Caption = square & "µm/m"
Label7.Caption = circularity & "mm"
'fermeture d'excel
waExcel.Application.Quit
End If
End Sub |
Partager