S
Shadok
Hi,
I want to open all the text files of a directory with the following code :
Application.ScreenUpdating = False
With Application.FileSearch
.LookIn = "\\ACB0SR40\16055\Celine\Autocentrage\Fichiers mesure\"
.SearchSubFolders = False
.Filename = ".txt"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
.Execute
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
NomFichier = .FoundFiles(i)
Workbooks.OpenText Filename:= _
.FoundFiles(i), Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited,
TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True,
Semicolon:=True, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1,
1), _
Array(2, 1)), DecimalSeparator:=".", TrailingMinusNumbers:=True
..........
but when I run the code step by step I can that the LookIn parameter value
still only is "\\ACB0SR40\16055\" which is my default directory. So, there is
no .txt files found never.
How can I make my path be accepted ?
Thanks a lot for your help
I want to open all the text files of a directory with the following code :
Application.ScreenUpdating = False
With Application.FileSearch
.LookIn = "\\ACB0SR40\16055\Celine\Autocentrage\Fichiers mesure\"
.SearchSubFolders = False
.Filename = ".txt"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
.Execute
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
NomFichier = .FoundFiles(i)
Workbooks.OpenText Filename:= _
.FoundFiles(i), Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited,
TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True,
Semicolon:=True, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1,
1), _
Array(2, 1)), DecimalSeparator:=".", TrailingMinusNumbers:=True
..........
but when I run the code step by step I can that the LookIn parameter value
still only is "\\ACB0SR40\16055\" which is my default directory. So, there is
no .txt files found never.
How can I make my path be accepted ?
Thanks a lot for your help