Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.Execute Not Working

Status
Not open for further replies.

Bonediggler1

Technical User
Jul 2, 2008
156
US
Hello-

I wrote some FileSearch code the gist of which is as follows:

Dim fs as object
set fs = application.filesearch

with fs
.lookin = blah
.filename = blah blah
If .execute() > 0 then...

There are files in the searched file path and it works on my machine, but when running from another user's machine it does not work...i.e. .execute = 0. Is there some setting that needs to be changed?

(The user does have access to the searched drive, file path etc.)


Thank you!
 
The relevant code is below. Last night I logged in as myself on the users computer and everything worked fine. This morning I gave full permissions to the related drive to the user (just to eliminate the permissions variable) and it still doesn't work. The .execute command still returns 0 for some reason...(only for this user!)

strFileName = "11_111_*.*"
strMoveFolder = strRawFileDir & "Imported" & "\"

Dim fs As Object
Dim fs1 As Object
Dim fs2 As Object
Dim i As Integer

Set fs = Application.FileSearch
Set fs1 = CreateObject("scripting.filesystemobject")
Set fs2 = fs1.getfolder(strRawFileDir)

With fs
.lookin = strRawFileDir
.filename = strFileName
If .Execute() > 0 Then
 
<Set fs = Application.FileSearch

What application is this?
 
Does it work for this user if this line is changed to a standard folder on the user's PC?

strMoveFolder = strRawFileDir & "Imported" & "\
 
Hi-

I came to the conclusion there was some setting unique to the user that prevented the "FileSearch" property from functioning properly. I replaced it with the "Scripting.FileSystemObject" object, which appears to be working fine.

Judging from articles on the web, this seems to be a farily common problem. I plan not to use the FileSearch property in future applications...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top