0

I have multiple Text files. They are all located in a specific directory.

Directory = "C:\Users\Bob\Documents\Projects"

The file would be listed within this directory as

BobFileA.txt
BobFileB.txt
BobFileC.txt

With each of these text files, there is some similar string of text. The string of text would be something like "IDStringHere" and the string of text resides within the file amongst other text such that it would be

787,Tangent(IDStringHere1)

Is there a way that I acn run a VBA script which will go through all the file i mentioned above, open them, find the string of text, Replace the string of text with another in-putted string of textbut with the new line commands "NewText"\n"String", and then save the file in a new format such as a ".CSV" so the goal of this would be to have the files,

BobFileA.csv
BobFileB.csv
BobFileC.csv

and within these files they would have ONLY the original string of text replaced with the new.

    787,Tangent(NewText
    String)

Thank you in advance. I am forever in your service.

Community
  • 1
  • 1
The_BMan
  • 105
  • 11
  • Exactly which part of this is giving you problems? – Tim Williams Feb 09 '16 at 19:48
  • I'm not sure what syntax would be that would from a VBA script would access the text file within a directory, open it, and find and replace the necessary strings. When I had looked into it it seemed like I was required to use some functions with FileSystemObjects, but I couldn't seem to employ that within the VBA editor. would this imply that visual studio? but also, hopw can find, insert functions be employed within a outside text document? – The_BMan Feb 10 '16 at 16:51
  • http://stackoverflow.com/questions/11528694/read-parse-text-file-line-by-line-in-vba – Tim Williams Feb 10 '16 at 16:58

0 Answers0