MrHuge
Board Regular
- Joined
- Jun 23, 2005
- Messages
- 219
I am trying to come up with ideas on how to create a text file based on an excel table and template .txt files.
Here is an explanation.
My Excel Table is like this.
Data.xlsx
The Template files look like this
Temp1.txt
Temp2.txt
And the Main File Looks like this:
Main.txt
So What i am trying to achieve (via a macro) is by running each row of my Excel Table (Data.xlsx), Open the Template file as stated in Column4 replace the Vars in the text file with the row data, then insert that data into the Insert_At location in the Main File.
The Output should look like this
Output.txt
I have done this in the past, but for the life of me i cannot remember how i achieved this.
Any help in pointing me in the right direction would be a huge help.
Thanks in Advance
Here is an explanation.
My Excel Table is like this.
Data.xlsx
Var1 | Var2 | Var3 | Template |
Testing | Row | 2 | temp1.txt |
Test | Again | Row 3 | temp1.txt |
Lets Try | template 2 | now | temp2.txt |
The Template files look like this
Temp1.txt
Code:
{$Insert_At Temp1}
{%Var1}
{%Var2}
{%Var3}
Temp2.txt
Code:
{$Insert_At Temp2}
{%Var1}, {%Var2}, {%Var3}
And the Main File Looks like this:
Main.txt
Code:
{Bookmark Temp1}
{Bookmark Temp2}
So What i am trying to achieve (via a macro) is by running each row of my Excel Table (Data.xlsx), Open the Template file as stated in Column4 replace the Vars in the text file with the row data, then insert that data into the Insert_At location in the Main File.
The Output should look like this
Output.txt
Code:
Testing
Row
2
Test
Again
Row 3
Lets Try, Template 2, now
I have done this in the past, but for the life of me i cannot remember how i achieved this.
Any help in pointing me in the right direction would be a huge help.
Thanks in Advance