Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problem with setting a R / W property, FileSearch, LookIn

I'm using typical FileSearch code in Excel to build a list of files and write
to the cells of a worksheet. In teh code shown below: date_txt is decalred
Public and dir is a local and are read from a worksheet.

The code runs fine on some computers but has a problem on others. The
problem is .LookIn can not be set to the value in dir. Using the Immediate
command window in debug doesn't allow setting .LookIn either.

Trying to set .LookIn has the symptoms of acting like .LookIn is not a write
property, does not issue any error, and leaves .LookIn with the default value
it is created with.

Running the code always returns 0 files when running on the problem computer.

Code follows.

Thanks,
chuckd

With Application.FileSearch
Set fs = Application.FileSearch
With fs
.LookIn = dir
.SearchSubFolders = True
.FileType = msoFileTypeAllFiles
.Filename = date_txt
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) 0 Then
For i = 1 To .FoundFiles.Count
report_macros_workbook.Worksheets("files").Cells(i + 1,
3).Value = .FoundFiles(i)
Next i
Else
' MsgBox " there are no file found."

End If
End With
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Problem with setting a R / W property, FileSearch, LookIn

I haven't reproduced the problem, but is this line getting in the way

With Application.FileSearch


I would delete it and its corresponding End With

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"chuckd" wrote in message
...
I'm using typical FileSearch code in Excel to build a list of files and

write
to the cells of a worksheet. In teh code shown below: date_txt is decalred
Public and dir is a local and are read from a worksheet.

The code runs fine on some computers but has a problem on others. The
problem is .LookIn can not be set to the value in dir. Using the Immediate
command window in debug doesn't allow setting .LookIn either.

Trying to set .LookIn has the symptoms of acting like .LookIn is not a

write
property, does not issue any error, and leaves .LookIn with the default

value
it is created with.

Running the code always returns 0 files when running on the problem

computer.

Code follows.

Thanks,
chuckd

With Application.FileSearch
Set fs = Application.FileSearch
With fs
.LookIn = dir
.SearchSubFolders = True
.FileType = msoFileTypeAllFiles
.Filename = date_txt
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) 0 Then
For i = 1 To .FoundFiles.Count
report_macros_workbook.Worksheets("files").Cells(i + 1,
3).Value = .FoundFiles(i)
Next i
Else
' MsgBox " there are no file found."

End If
End With
End With



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problem with setting a R / W property, FileSearch, LookIn

Thanks for the suggestion. The change didn't help
chuckd

"Bob Phillips" wrote:

I haven't reproduced the problem, but is this line getting in the way

With Application.FileSearch


I would delete it and its corresponding End With

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"chuckd" wrote in message
...
I'm using typical FileSearch code in Excel to build a list of files and

write
to the cells of a worksheet. In teh code shown below: date_txt is decalred
Public and dir is a local and are read from a worksheet.

The code runs fine on some computers but has a problem on others. The
problem is .LookIn can not be set to the value in dir. Using the Immediate
command window in debug doesn't allow setting .LookIn either.

Trying to set .LookIn has the symptoms of acting like .LookIn is not a

write
property, does not issue any error, and leaves .LookIn with the default

value
it is created with.

Running the code always returns 0 files when running on the problem

computer.

Code follows.

Thanks,
chuckd

With Application.FileSearch
Set fs = Application.FileSearch
With fs
.LookIn = dir
.SearchSubFolders = True
.FileType = msoFileTypeAllFiles
.Filename = date_txt
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) 0 Then
For i = 1 To .FoundFiles.Count
report_macros_workbook.Worksheets("files").Cells(i + 1,
3).Value = .FoundFiles(i)
Next i
Else
' MsgBox " there are no file found."

End If
End With
End With




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
Lookin property of the FileSearch object [email protected] New Users to Excel 0 December 5th 06 09:37 PM
csv for filetype property of filesearch object smokiibear Excel Programming 3 December 14th 04 04:59 PM
Cannot assign value to Filesearch.Lookin QQExcel Excel Programming 3 August 5th 04 04:20 PM
Lookin Property. Simon[_14_] Excel Programming 3 April 20th 04 02:17 PM
FileSearch Problem Nigel[_4_] Excel Programming 4 October 11th 03 03:43 PM


All times are GMT +1. The time now is 10:38 PM.

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

About Us

"It's about Microsoft Excel"