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
| Option Explicit
Sub traiterDMC()
Dim f As String
Dim uf As ufDMC
Dim dernLigne As Long
f = Application.GetOpenFilename("Fichier DMC , *.*")
If f <> "" Then
If openDMC(f) Then
Set uf = New ufDMC
uf.Show
If uf.bSave Then saveDMC f
Unload uf
End If
End If
End Sub
Private Function openDMC(ByVal f As String) As Boolean
Dim s As String
Dim i As Long
openDMC = False
'f = Application.GetOpenFilename("Fichier DMC , *.*")
'If f <> "" Then
Worksheets("DATA_DMC").Cells.ClearContents
Open f For Input As #1
i = 1
Do Until EOF(1)
Line Input #1, s
Worksheets("DATA_DMC").Cells(i, 1).Value = s
i = i + 1
Loop
Close #1
openDMC = True
'End If
End Function
Private Function saveDMC(ByVal f As String) As Boolean
Dim i As Long
MsgBox "Saved"
' - - - - - -
Exit Function
' - - - - - -
Open f For Output As #2
i = 1
With Worksheets("DATA_DMC")
While .Cells(i, 1).Value <> ""
'boucle sur cellules
Write #2, .Cells(i, 1).Value
i = i + 1
Wend
End With
Close #2
End Function |
Partager