I've got a program that open the files of a folder and apply them a
formatting. One file by sheet. The files are text. At first, it open
the file with "delimiter tab". At second, the columns A to L are
deleted. At third, the column A is formated with "delimiter
other ;". The pb is: "once the first file are made, the others files
are not made correctly. The formatting are bad. It seems that the
option "delimiter other ;" is applied at opening of the following
file.
Who to avoid this?
Here's an extract of the program which is included in a loop which
skim the folder:
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & rep & fic, Destination:=Range("A1"))
.name = proc
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Columns("A:L").Select
Selection.Delete Shift:=xlToLeft
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True,
OtherChar:=";", _
FieldInfo:=Array(1, 1), TrailingMinusNumbers:=True
Selection.ColumnWidth = 18.71
Columns("A:A").Select
Selection.NumberFormat = "0000000000"