Visual Basics File Search
|
Original Message
|
Name: Tyler
Date: September 18, 2003 at 07:53:19 Pacific
Subject: Visual Basics File SearchOS: XP ProCPU/Ram: 2.8 GHz, 512 MB Ram |
Comment: I am writing code to do a file search using With Application.FileSearch Code Code Code End With Within that With Statement, I am executing a For Loop to go through the files that were found. For some reason, it is completely skipping the For Loop and Ending the With Statement and Function. I think the reason it is doing this is because it is not finding any files. I know for a fact that the folder it is searching is correct, and the file type that it is looking for is correct. I just don't know why it's not finding any files. Here is the code... Somebody please give me some help. Thanks Function DetermineFile() With Application.FileSearch .NewSearch .LookIn = "S:\Technical Documents\blades\temporary change tags" .SearchSubFolders = True .TextOrProperty = "run" .MatchAllWordForms = True .FileType = msoFileTypeAllFiles For ii = 1 To .FoundFiles.Count MsgBox .FoundFiles(ii) Documents.Open .FoundFiles(ii) '' Work with the current open file here '' Dim OPnum Dim Recip Dim RemDate Dim ExpDate Dim myDate As String myDate = Date RemDate = ActiveDocument.Tables(1).Cell(1, 1) RemDate = RemDate.ConvertToText ExpDate = ActiveDocument.Tables(1).Cell(1, 2) Recip = ActiveDocument.Tables(1).Cell(1, 3) OPnum = ActiveDocument.Tables(1).Cell(1, 4) With RemDate If RemDate = Date Then ActiveDocument.HasRoutingSlip = True With ActiveDocument.RoutingSlip .Subject = "A Temporary Change Tag is About to Expire" .Message = OPnum .Message = ExpDate .AddRecipient Recip End With ActiveDocument.Route Else End If End With Next ii End With End Function
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: shockley
Date: September 19, 2003 at 12:10:32 Pacific
|
Reply: (edit)Try the search like this: With Application.FileSearch .NewSearch .LookIn = "S:\Technical Documents\blades\temporary change tags" .SearchSubFolders = True .FileType = msoFileTypeAllFiles .Execute For ii = 1 To .FoundFiles.Count
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: