Dim fs, f,
f1, fc, s
Const ForReading = 1
Const ForWriting = 2
cnt=0
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.SubFolders
For Each f1 in fc
If instr(1,f1.name,"_") and instr(1,f1.name,"OBI")=0 and instr(1,f1.name,"IGL")=0 and instr(1,f1.name,"ILP")=0 and instr(1,f1.name,"WMP")=0 and instr(1,f1.name,"APAC")=0 and instr(1,f1.name,"NETM")=0 and instr(1,f1.name,"ITBI")=0 Then
print f1.name
Set objFile = fs.OpenTextFile(f1 & inside, ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "<text1>", "",1, -1, vbTextCompare)
strNewText = Replace(strNewText, "<text2>","",1, -1, vbTextCompare)
strNewText = Replace(strNewText, "<text3>","",1, -1, vbTextCompare)
Set objFile = fs.OpenTextFile(f1 & inside, ForWriting)
objFile.WriteLine strNewText
objFile.Close
cnt=cnt+1
End If
Next
print cnt
set fs=nothing
End Sub
Const ForReading = 1
Const ForWriting = 2
cnt=0
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.SubFolders
For Each f1 in fc
If instr(1,f1.name,"_") and instr(1,f1.name,"OBI")=0 and instr(1,f1.name,"IGL")=0 and instr(1,f1.name,"ILP")=0 and instr(1,f1.name,"WMP")=0 and instr(1,f1.name,"APAC")=0 and instr(1,f1.name,"NETM")=0 and instr(1,f1.name,"ITBI")=0 Then
print f1.name
Set objFile = fs.OpenTextFile(f1 & inside, ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "<text1>", "",1, -1, vbTextCompare)
strNewText = Replace(strNewText, "<text2>","",1, -1, vbTextCompare)
strNewText = Replace(strNewText, "<text3>","",1, -1, vbTextCompare)
Set objFile = fs.OpenTextFile(f1 & inside, ForWriting)
objFile.WriteLine strNewText
objFile.Close
cnt=cnt+1
End If
Next
print cnt
set fs=nothing
End Sub