1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Sub Macro1()
Dim Sh As Worksheet
Dim Fichier As Variant
Dim Chemin As String
Application.ScreenUpdating = False
Chemin = "C:\Documents and Settings\Administrateur\Bureau"
ChDrive "C:"
ChDir Chemin
Fichier = Application.GetOpenFilename("Excel files(*.xls),.xls")
If Fichier <> False Then
Set Sh = ThisWorkbook.Worksheets("Feuil7")
With Sh.QueryTables.Add(Connection:="TEXT;" & Fichier, Destination:=Sh.Range("A1"))
.Name = Replace(Mid(Fichier, InStrRev(Fichier, "\") + 1), ".xls", "")
.TextFileColumnDataTypes = Array(4, 4, 1, 1, 1)
.Refresh BackgroundQuery:=False
End With
Set Sh = Nothing
End If
End Sub |
Partager