bonjour à tous
Laurent, as tu essayé la modification proposée par Myta ?
Dim Fichier As Variant
Dim Longueur As Integer, i As Integer
Dim Repertoire As String
Repertoire = 'C:\\\\\\\\Documents and Settings\\\\\\\\michel\\\\\\\\dossier'
ChDir Repertoire
Fichier = Application.GetOpenFilename('Fichiers Texte (*.txt), *.txt')
If Fichier = False Then Exit Sub
Longueur = Len(Fichier)
i = Longueur
While Mid(Fichier, i, 1) ‹› '\\\\\\\\\\'
i = i - 1
Wend
With ActiveSheet.QueryTables.Add(Connection:= _
'TEXT;' & Fichier, Destination:=Range('A1'))
.Name = Mid(Fichier, i + 1, Longueur - i)
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1)
.Refresh BackgroundQuery:=False
End With
bon apres midi
MichelXld
Message édité par: michelxld, à: 11/04/2006 12:47