VBA loops

ocean123

New Member
Joined
Jun 11, 2011
Messages
1
I want to create a number of text files using VBA.

Each file will have a particular header eg "UK News", "USA News" "Irish News"

The files will be created as Word documents and stored in a folder C:\inbound

The text files need to be created in a folder called C:\outbound
(The files need to saved as unicode text files)

The input file names will be: UK.doc, usa.doc, ireland.doc
Output file names need to have a prefix eg UKddmmyy.txt, USddmmyy.txt

I thought it might work to have these variables stored in cells in a Excel spreadsheet - and then we can modify them as our need changes.
Variables:
Headers: File name Prefixes:
UK News UK
USA News USA
Irish News IE


Could anyone advise how we could use VBA to input the headers into each file, and then save them with correct names. I presume some form of loops/arrays will be needed but am not that good with these !

Many thanks
Mat
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,224,518
Messages
6,179,259
Members
452,901
Latest member
LisaGo

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