+ Reply to Thread
Results 1 to 3 of 3

Amending a text file

  1. #1
    Registered User
    Join Date
    07-15-2005
    Posts
    11

    Amending a text file

    Hi Guy's

    I am trying to create a small data with customer info from an excel worksheet. I am currently able to export the information into a text file and understand that by using the code "output" it will create a new file or alternatively using the code "append" and it will add the info to the end of the file.

    However....

    Can anyone help me with amending the data once in the text file i think it is the replace function but have no idea of the code.

    Any help would be fantastic

    Thanks
    Dave

  2. #2
    K Dales
    Guest

    RE: Amending a text file

    You will need to open the file with Random access for Read Write; e.g.
    Open "C:\Myfile.txt" for Random Read Write as #1
    It needs to be random access so you can read in data, then "skip back" to
    re-write that data back to the file. Then use Input# or Get to read the data
    from the file; read it in, edit it, and write it back with Write# or Print#
    or Put. For details see VBA help files on all these functions and also the
    topic "Writing Data to Files."
    --
    - K Dales


    "DHallam" wrote:

    >
    > Hi Guy's
    >
    > I am trying to create a small data with customer info from an excel
    > worksheet. I am currently able to export the information into a text
    > file and understand that by using the code "output" it will create a
    > new file or alternatively using the code "append" and it will add the
    > info to the end of the file.
    >
    > However....
    >
    > Can anyone help me with amending the data once in the text file i think
    > it is the replace function but have no idea of the code.
    >
    > Any help would be fantastic
    >
    > Thanks
    > Dave
    >
    >
    > --
    > DHallam
    > ------------------------------------------------------------------------
    > DHallam's Profile: http://www.excelforum.com/member.php...o&userid=25253
    > View this thread: http://www.excelforum.com/showthread...hreadid=387948
    >
    >


  3. #3
    Registered User
    Join Date
    07-15-2005
    Posts
    11
    Thanks for your previous reply, unfortunately I am still not able to solve it however I have now posted a more accurate description of what it is I believe I require.

    Kind Regards
    Dave

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1