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
| Sub Import()
Dim Adresse As String ' Variable qui va contenir l'adresse du dossier + les éléments pour
'identifier le documents à importer.
Adresse = "C:\Documents and Settings\JESSICA\Mes documents\Documents\magasin & journal & annee & mois.txt"
' Affectation de l'adresse du dossier à la variable Adresse
With ActiveSheet.QueryTables.Add(Connection = Adresse, Destination = Range("A1"))
.Name = "004RE704"
.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 = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(1, 8, 1, 11, 1, 9, 1, 9, 1, 11, 1, 11, 1, 11, 1, 11, 1, 8 _
, 1)
.Refresh BackgroundQuery:=False |
Partager