Function GetNiemeLigne(byVal N as long,ByVal Fic as String) as String Dim FN as Long, Buffer As String Fn = FreeFile Open Fic for Input as #FN On Error Goto TooShort While N>0 Line Input #FN, Buffer N=N-1 Wend GetNiemeLigne = Buffer Exit Function TooShort: Msgbox "Le fichier " & Fic & " ne contient pas assez de ligne,vbOKOnly + vbCritical End Function
Sub WriteNiemeLigne(ByVal N as Long, ByVal Fic as String, ByVal Ligne as String) Dim FN as Long, FNtmp as longBuffer As String Fn = FreeFile Open Fic for Input as #FN FNTmp = freefile Open Fic & "Unbeautemporaire" for output as #FNtmp On Error Goto TooShort While N>1 Line Input #FN, Buffer Print #FNTmp,buffer N=N-1 Wend Print #FNTmp,Ligne Close #FN Close #FNtmp Kill Fic FileCopy Fic & "Unbeautemporaire", Fic Kill Fic & "Unbeautemporaire" Exit Sub TooShort: Msgbox "Le fichier " & Fic & " ne contient pas assez de ligne,vbOKOnly + vbCritical End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question