#1
  1. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jul 2004
    Posts
    74
    Rep Power
    11

    Adding text to a file using VBA


    Hi all,

    I have some code that exports a table as a .csv file (running an append query to move selected records to a temp table then using DoCmd.TransferText).

    I want to add a line of text at the start of the file.

    One way I think I could do it is by using FileSystemObject to read the entire file and write it to a new file, but with a new line at the top. I don't want to do this as it seems like a very inefficient method - particularly as the .csv may be many thousands of lines.

    I originally 'solved' the problem by having an append query add a line of text to the first field in the table before the main query runs. I thought this was a great idea until I realised that the line would also contain commas for each blank field afterwards, which is a problem.

    Is there a better way of doing it?

    Cheers,

    Charlie
    Last edited by Charlie_B; December 3rd, 2012 at 11:36 AM.
  2. #2
  3. No Profile Picture
    Registered User

    Join Date
    Feb 2013
    Posts
    1
    Rep Power
    0
    Here's a simple explanation on how to read data from and write data to text file in asp.net How to read data from and write data to text file in Asp.Net | Free Dotnet Applications

Similar Threads

  1. Replies: 33
    Last Post: November 23rd, 2006, 10:28 AM
  2. Adding text formats to a text area - How?
    By elenton in forum ASP Development
    Replies: 3
    Last Post: June 6th, 2005, 04:43 AM
  3. Uploading file - Adding random numbers to file name
    By NoNerd in forum ASP Development
    Replies: 17
    Last Post: May 4th, 2005, 10:37 AM
  4. Adding Instruction Text In Text Box?
    By RoofusX in forum Microsoft Access Help
    Replies: 5
    Last Post: November 4th, 2004, 01:51 PM
  5. Replies: 0
    Last Post: January 24th, 2002, 02:18 PM

IMN logo majestic logo threadwatch logo seochat tools logo