|| Feedback | Part One of text files | Forms ||
[Back to page one]
The previous page has looked at saving a table or list of data in a fixed width format. The second example takes a single record from a form and saves it in a text file with distinct fields for each piece of data. The details will be saved in a comma separated file which can easily be recognised and imported by other programs without any complicated decyphering. This method could have been applied to the previous table.
|6||Simple Debtors Invoice|
|13||Item 1||Wag the Dog DVD||21.55|
|14||Item 2||Carry on Doctor||16.50|
If the data is to be exported to a text file the program will need to determine whether it posting the record to a new text file or if it is adding data to an already existing file. The <Run Macro> button on the form (above) is linked to the following macro.
See also help in creating macros or assigning macros to buttons.
The exported text file (named C:\formtest.txt) looks like this:
|"Tony Tinker","14558","Chris","Wag the Dog DVD",21.55,"Carry on Bob",16.5
"Paul Sailor","14552","Chris","Wachet Betet",15.99,"Beati Quorum",4.2
"Bob Tailor","14553","Chris","Smelling salts",1.23,"Copper wire",45
This macro can be modified to import the contents of a text file into a range of cells.
|19||Import text file of invoices|
|20||Tony Tinker||14558||Chris||Wag the Dog DVD||21.55||Carry on Bob||16.5|
|21||Paul Sailor||14552||Chris||Wachet Betet||15.99||Beati Quorum||4.2|
|22||Bob Tailor||14553||Chris||Smelling salts||1.23||Copper wire||45|
Part one - exporting data from a list
|This page is included in
the Excel functions guide
|Click here for details about
obtaining this file
|file: xlexport-text1.htm.htm||Last updated Nov11||© MeadInKent.co.uk 2016||CMIDX S5 P20a Y|