I don't know what I'm doing, something like:Run testSub test() For Each cll In Range("A2:A300").Cells blah2 "C:\XML_Source_Files\" & cll.Value, "C:\output\" & cll.Value Next cll End Sub Sub blah2(myFullPathAndNameSource, myFullPathAndNameDestn) Dim FSO As Object Set FSO = CreateObject("Scripting.FileSystemObject") xx = FSO.OpenTextFile(myFullPathAndNameSource).ReadAll 'your source file pos1 = InStr(xx, "<referencedApplicGroup>") pos2 = InStr(xx, "</referencedApplicGroup>") newxx = Left(xx, pos1 - 1) & Mid(xx, pos2 + 24) insertText = Mid(xx, pos1, pos2 - pos1 + 24) pos3 = InStr(newxx, "<content>") newxxx = Left(newxx, pos3 - 1) & insertText & Mid(newxx, pos3) Set txtstr = FSO.CreateTextFile(myFullPathAndNameDestn, True, True) 'your destination file. txtstr.Write newxxx txtstr.Close End Sub