mibushk
10-16-2009, 04:40 AM
Hello,
:banghead: I have around 500 files (excell, word, powerpoint) which have as property in company field one name.
I managed with Filesearch funtion to list the documeents that have the " John" attribute, and now I have to set the attribute to "Mary"
I do not know how to do it,
I attach what I have done till now:
Public Sub cmdFileSearch1_click()
Dim field As String
Set fs = Application.FileSearch
With fs
.LookIn = "D:\PSAD_Process"
.SearchSubFolders = True
.TextOrProperty = "*john*"
If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0 Then
thisFile = 1
field = .TextOrProperty
For i = 1 To .FoundFiles.Count
afile = .FoundFiles(i)
If afile <> ThisWorkbook.Path & "\" & ThisWorkbook.Name Then
'MsgBox .TextOrProperty
ActiveSheet.Cells(i, 3).Value = afile
ActiveSheet.Cells(i, 4).Value = field
End If
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub
please help
:banghead: I have around 500 files (excell, word, powerpoint) which have as property in company field one name.
I managed with Filesearch funtion to list the documeents that have the " John" attribute, and now I have to set the attribute to "Mary"
I do not know how to do it,
I attach what I have done till now:
Public Sub cmdFileSearch1_click()
Dim field As String
Set fs = Application.FileSearch
With fs
.LookIn = "D:\PSAD_Process"
.SearchSubFolders = True
.TextOrProperty = "*john*"
If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0 Then
thisFile = 1
field = .TextOrProperty
For i = 1 To .FoundFiles.Count
afile = .FoundFiles(i)
If afile <> ThisWorkbook.Path & "\" & ThisWorkbook.Name Then
'MsgBox .TextOrProperty
ActiveSheet.Cells(i, 3).Value = afile
ActiveSheet.Cells(i, 4).Value = field
End If
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub
please help