Parsing Data Question

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
Var1Var2Var3Template
TestingRow2temp1.txt
TestAgainRow 3temp1.txt
Lets Trytemplate 2nowtemp2.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
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,214,989
Messages
6,122,622
Members
449,093
Latest member
catterz66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top