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
 

Some videos you may like

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Watch MrExcel Video

Forum statistics

Threads
1,123,514
Messages
5,602,087
Members
414,501
Latest member
mdhaumyu

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
Top