Dans ce fichier, j'extrait les données d'un fichier txt de manière visible pour pouvoir le modifier.
Quand j'ai sélectionné mon fichier, que ma combo box s'ouvre et que j'ai modifié ce que je souhaite modifier il n'enregistre pas ma modification
Voici le code que j'ai
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
Quelqu'un pourrait il m'aider
Je vous remercie
Cdt