Hi!
I have a standard fileserach function that should open files on a given location in word, but somehow the specification of the location fails. It doesn't set det "LookIn" prperty at all. On another server it works just fine, but on this particular server it just won't set. Is there some preferences or something that I should change to fix the problem?
In advance, thanks!
Here's the code:
Dim strFileSearch() As Variant
Dim intFileCount As Integer
On Error GoTo feil
Set fs = Application.FileSearch
With fs
.LookIn = "C:\"
'StrDirectory_To_Search_For_files
.FileName = "*.doc" 'type of file to search for
.SearchSubFolders = True
If .Execute > 0 Then
intFileCount = .FoundFiles.Count
ReDim strFileSearch(intFileCount)
For i = 1 To .FoundFiles.Count
Debug.Print .FoundFiles.Count
strFileSearch(i) = .FoundFiles(i)
Next i
Else
f.writelie Date + Time & " Feil ved henting av fil i modul Autoexec/Autoexec"
'MsgBox "There were no files found", vbInformation + vbOKOnly
End If
End With
For i = 1 To intFileCount
Documents.Open strFileSearch(i)
Next i
Pål Nesteby
PDC-Tangen
Norway
I have a standard fileserach function that should open files on a given location in word, but somehow the specification of the location fails. It doesn't set det "LookIn" prperty at all. On another server it works just fine, but on this particular server it just won't set. Is there some preferences or something that I should change to fix the problem?
In advance, thanks!
Here's the code:
Dim strFileSearch() As Variant
Dim intFileCount As Integer
On Error GoTo feil
Set fs = Application.FileSearch
With fs
.LookIn = "C:\"
'StrDirectory_To_Search_For_files
.FileName = "*.doc" 'type of file to search for
.SearchSubFolders = True
If .Execute > 0 Then
intFileCount = .FoundFiles.Count
ReDim strFileSearch(intFileCount)
For i = 1 To .FoundFiles.Count
Debug.Print .FoundFiles.Count
strFileSearch(i) = .FoundFiles(i)
Next i
Else
f.writelie Date + Time & " Feil ved henting av fil i modul Autoexec/Autoexec"
'MsgBox "There were no files found", vbInformation + vbOKOnly
End If
End With
For i = 1 To intFileCount
Documents.Open strFileSearch(i)
Next i
Pål Nesteby
PDC-Tangen
Norway