See if this does it.Code:Option Explicit Dim FSO, FLD, FIL, TS Dim strFolder, strContent, strPath Const ForReading = 1, ForWriting = 2, ForAppending = 8 'Change as needed strFolder = "C:\Documents and Settings\Mark\Desktop\VBS Sample" 'Create the filesystem object Set FSO = CreateObject("Scripting.FileSystemObject") 'Get a reference to the folder you want to search set FLD = FSO.GetFolder(strFolder) 'loop through the folder and get the files For Each Fil In FLD.Files 'Open the file to read Set TS = FSO.OpenTextFile(fil.Path, ForReading) 'Read the contents into a variable strContent = TS.ReadAll 'Close the file TS.Close 'Replace the tabs strContent = Replace(strContent, vbTab, " ") 'Open the file to overwrite the contents Set TS = FSO.OpenTextFile(fil.Path, ForWriting) 'Write the contents back TS.Write strContent 'Close the current file TS.Close Next 'Clean up Set TS = Nothing Set FLD = Nothing Set FSO = Nothing




Reply With Quote