Find and replace text using a data file and "Save As"
This is a little embarrassing. I have not needed to code anything in over 20 years. I used to hang out on forums like this answering questions like this about Visual Basic back when Windows 3.1 was the OS. But it has been too long.
Please guide me as best you can. If you could just supply the right words for the concepts in the pseudocode, that would be great. If you could code it, I would be ever so grateful. I would prefer having it work across multiple versions of Word if possible. I am hoping the code is pretty generic and will not have changed much, if at all. I am using 2003, 2007 and 2010 versions of Word, and I imagine the people I will be sharing this with will be as well.
I use Adobe Premiere Pro to edit videos. If I export a title I get a text file (XML) filled with all kinds of stuff, but the text I want to change is just plain text. So it could be <XYZ> and I could find and replace it to achieve my goal. It seems to me that it should look something like this:
I open the Data file which has multiple lines of text - anywhere from 2 to 1000 or more. This is the file where the Macro button resides.
The psuedocode:
File Open Dialog ''''find and open the text file that I will change over and over again
Search for XYZ ''''XYZ being the temporary text I use to help identify the place in the file that needs to be changed
Read first line of data file ''''usually not more than 40 characters but could be up to 255
Replace XYZ with first line
Save As filename plus -n ''''Save text file to new name - n is a number that increments from 0001 to 9999
Read 2nd line of data file
Replace 1st line with 2nd line
Save As filename - incrementing n
Repeat until EOF
EOF post a message saying "Done"
This should leave me with a directory full of individual files numbered sequentially.
In case it helps, the section of the file I am changing looks like this:
<TRString>XYZ</TRString>
The file extension is .prtl
It seems like it should be easy but the actual code is escaping me.
Thank you for taking the time to read this and if you can help, I would be appreciative. If you would be willing to code it and want credit for your work, the entire Adobe video editing community would be happy to shower you with praise. We have the pedestal all ready for you to stand on. :)
-- Steven