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:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD="align: center"]Company Name:[/TD]
[TD="align: center"]CarSalesPtyLtd[/TD]
[TD="align: center"][/TD]
[TD="align: center"]Code:[/TD]
[TD="align: center"]CSPL04[/TD]
[/TR]
[TR]
[TD="align: center"]VEHICLE NUMBER[/TD]
[TD="align: center"]MAKE[/TD]
[TD="align: center"]MODEL[/TD]
[TD="align: center"]YEAR[/TD]
[TD="align: center"]COLOUR[/TD]
[/TR]
[TR]
[TD]ABC123[/TD]
[TD]TOYOTA[/TD]
[TD]HILUX[/TD]
[TD]2000[/TD]
[TD]WHITE[/TD]
[/TR]
[TR]
[TD]DEF456[/TD]
[TD]FORD[/TD]
[TD]FOCUS[/TD]
[TD]1998[/TD]
[TD]RED[/TD]
[/TR]
[TR]
[TD]GHI789[/TD]
[TD]MERCEDES[/TD]
[TD]SLK GTR[/TD]
[TD]2011[/TD]
[TD]GREY[/TD]
[/TR]
[TR]
[TD]JKL012[/TD]
[TD]TOYOTA[/TD]
[TD]CAMRY[/TD]
[TD]2013[/TD]
[TD]BLACK[/TD]
[/TR]
[TR]
[TD]PQR678[/TD]
[TD]NISSAN[/TD]
[TD]SKYLINE[/TD]
[TD]1999[/TD]
[TD]WHITE[/TD]
[/TR]
</tbody>[/TABLE]
Once done, the user clicks on a button which should create a TXT file as follows:
CarSalesPtyLtd
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
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 "
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:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD="align: center"]Company Name:[/TD]
[TD="align: center"]CarSalesPtyLtd[/TD]
[TD="align: center"][/TD]
[TD="align: center"]Code:[/TD]
[TD="align: center"]CSPL04[/TD]
[/TR]
[TR]
[TD="align: center"]VEHICLE NUMBER[/TD]
[TD="align: center"]MAKE[/TD]
[TD="align: center"]MODEL[/TD]
[TD="align: center"]YEAR[/TD]
[TD="align: center"]COLOUR[/TD]
[/TR]
[TR]
[TD]ABC123[/TD]
[TD]TOYOTA[/TD]
[TD]HILUX[/TD]
[TD]2000[/TD]
[TD]WHITE[/TD]
[/TR]
[TR]
[TD]DEF456[/TD]
[TD]FORD[/TD]
[TD]FOCUS[/TD]
[TD]1998[/TD]
[TD]RED[/TD]
[/TR]
[TR]
[TD]GHI789[/TD]
[TD]MERCEDES[/TD]
[TD]SLK GTR[/TD]
[TD]2011[/TD]
[TD]GREY[/TD]
[/TR]
[TR]
[TD]JKL012[/TD]
[TD]TOYOTA[/TD]
[TD]CAMRY[/TD]
[TD]2013[/TD]
[TD]BLACK[/TD]
[/TR]
[TR]
[TD]PQR678[/TD]
[TD]NISSAN[/TD]
[TD]SKYLINE[/TD]
[TD]1999[/TD]
[TD]WHITE[/TD]
[/TR]
</tbody>[/TABLE]
Once done, the user clicks on a button which should create a TXT file as follows:
CarSalesPtyLtd
CSPL04
YYYYMMDDHHMMSS StartVehicle, 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 EndAlso, 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
Many thanks in advance!
Cheers,
VJ
Last edited: