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
|
Const DATAOBJECT_BINDING As String = "new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}"
Sub on_y_va()
Dim Repertoire As FileDialog, monRepertoire As String
Set Repertoire = Application.FileDialog(msoFileDialogFolderPicker)
Repertoire.Show
If Repertoire.SelectedItems.Count > 0 Then
monRepertoire = Repertoire.SelectedItems(1)
fichs = Dir(monRepertoire & "\*.txt")
Do While fichs <> ""
aspire CStr(monRepertoire & "\" & fichs)
fichs = Dir
Loop
Columns("A:A").TextToColumns Destination:=Range("A1"), Space:=False
Else
MsgBox "Aucun Répertoire Sélectionné"
End If
End Sub
*
Sub aspire(fichier)
If Right(fichier, 4) = ".txt" Then
i = Cells(Rows.Count, 1).End(xlUp).Row
Open FICHIER For Input As #1
PressePapier = Input(LOF(1), #1)
Close #1
If i >1 then i=i+1
Cells(i,"A").PasteSpecial xlPasteAll
Rows(i & ":" & i +1).delete
If i>1 then rows(i).delete
End If
End Sub
Public Property Let PressePapier(Value)
With CreateObject(DATAOBJECT_BINDING)
.SetText Value
.PutInClipboard
End With
End Property
Public Property Get PressePapier()
With CreateObject(DATAOBJECT_BINDING)
.GetFromClipboard
PressePapier = .GetText
End With
End Property |
Partager