Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default FileSearch parameters locked

No, the trouble appears before.
At the step "With Application.FileSearch" the LookInd state is already
"\\ACB0SR40\16055\", and it doesn't change after the step ".LookIn =...." and
this for any directory I choose!! It's like as if it was locked, and I do'nt
how to unlock it.

"Brent" wrote:

i think for .Filename = ".txt" it should be .Filename = "*.txt"

otherwise you just get files with no name.


"Shadok" wrote:

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default FileSearch parameters locked

According to the Help on the FileSearch Object:
"Use the NewSearch method to reset the search criteria .......

Having said that, I would avoid the FileSearch as it appears flakey in its
results/behaviour. Also, it has been removed from Office 2007.
You can achieve all the same functionality with VBA's built-in Dir( ).

NickHK

"Shadok" wrote in message
...
No, the trouble appears before.
At the step "With Application.FileSearch" the LookInd state is

already
"\\ACB0SR40\16055\", and it doesn't change after the step ".LookIn =...."

and
this for any directory I choose!! It's like as if it was locked, and I

do'nt
how to unlock it.

"Brent" wrote:

i think for .Filename = ".txt" it should be .Filename = "*.txt"

otherwise you just get files with no name.


"Shadok" wrote:

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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default FileSearch parameters locked

I use Office 2003...but thanks a lot for the idea of Dir( ), it's easier and
it works !

"NickHK" wrote:

According to the Help on the FileSearch Object:
"Use the NewSearch method to reset the search criteria .......

Having said that, I would avoid the FileSearch as it appears flakey in its
results/behaviour. Also, it has been removed from Office 2007.
You can achieve all the same functionality with VBA's built-in Dir( ).

NickHK

"Shadok" wrote in message
...
No, the trouble appears before.
At the step "With Application.FileSearch" the LookInd state is

already
"\\ACB0SR40\16055\", and it doesn't change after the step ".LookIn =...."

and
this for any directory I choose!! It's like as if it was locked, and I

do'nt
how to unlock it.

"Brent" wrote:

i think for .Filename = ".txt" it should be .Filename = "*.txt"

otherwise you just get files with no name.


"Shadok" wrote:

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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Locked worksheet & hyperlinks (w/ select locked cells unchecked) dgold82 Excel Discussion (Misc queries) 1 July 10th 09 09:42 PM
FileSearch - help -Zoki- Excel Programming 4 April 25th 06 06:12 PM
Put comments on a locked spreadsheet even though cells not locked RDP Excel Worksheet Functions 1 September 11th 05 11:59 PM
I want the macros to be locked up when cells are locked up. Ed Excel Programming 6 February 20th 05 01:31 AM
.FileSearch Randall[_3_] Excel Programming 4 November 26th 03 01:48 AM


All times are GMT +1. The time now is 06:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"