Create a TXT file from contents in a XLSM file

VJ1985

New Member
Joined
Aug 1, 2013
Messages
8
Hi Guys,

I'm new to Excel with regards to Macros/VBA and hence need help to create a TXT file from the contents in a XLSM file.

The user enters the information in an XLSM file as follows:

Company Name:CarSalesPtyLtdCode:CSPL04
VEHICLE NUMBERMAKEMODELYEARCOLOUR
ABC123TOYOTAHILUX2000WHITE
DEF456FORDFOCUS1998RED
GHI789MERCEDESSLK GTR2011GREY
JKL012TOYOTACAMRY2013BLACK
PQR678NISSANSKYLINE1999WHITE

<tbody>
</tbody>












Once done, the user clicks on a button which should create a TXT file as follows:
CarSalesPtyLtd
CSPL04​
YYYYMMDDHHMMSS Start
Vehicle, 1, ABC123, TOYOTA, HILUX, 2000, WHITE
Vehicle, 2, DEF456, FORD, FOCUS, 1998, RED
Vehicle, 3, GHI789, MERCEDES, SLK GTR, 2011, GREY
Vehicle, 4, JKL012, TOYOTA, CAMRY, 2013, BLACK
Vehicle, 5, PQR678, NISSAN, SKYLINE, 1999, WHITE
CarSales​
PtyLtd
CSPL04​
YYYYMMDDHHMMSS End




Also, once the user clicks the button, is it possible to save the TXT file with a filename from the cell contents, but prompt the user for the save location?

For instance, save the above TXT file as "
CarSalesPtyLtd-CSPL04.TXT"
Many thanks in advance!
Cheers,
VJ​
 
Last edited:

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Not sure why the above text is aligned like that... looked fine in the editor!

Anyway, this how the TXT file should appear:

CarSalesPtyLtd, CSPL04, YYYYMMDDHHMMSS, Start
Vehicle, 1, ABC123, TOYOTA, HILUX, 2000, WHITE
Vehicle, 2, DEF456, FORD, FOCUS, 1998, RED
Vehicle, 3, GHI789, MERCEDES, SLK GTR, 2011, GREY
Vehicle, 4, JKL012, TOYOTA, CAMRY, 2013, BLACK
Vehicle, 5, PQR678, NISSAN, SKYLINE, 1999, WHITE
CarSalesPtyLtd, CSPL04, YYYYMMDDHHMMSS, End

Thanks again!
VJ
 
Upvote 0

Forum statistics

Threads
1,215,652
Messages
6,126,037
Members
449,281
Latest member
redwine77

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