+ Reply to Thread
Results 1 to 11 of 11

Clear data from text file

  1. #1
    Forum Contributor tax112's Avatar
    Join Date
    02-28-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2016 | 2019
    Posts
    438

    Clear data from text file

    Hi everybody.
    Someone can help me delete data in a text file.
    Thank you.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,958

    Re: Clear data from text file

    Yes, but it would be helpful if you uploaded a sample file so that we know what to delete. More information is needed.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    Hi !

    See Kill statement in VBA help …

  4. #4
    Forum Contributor tax112's Avatar
    Join Date
    02-28-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2016 | 2019
    Posts
    438

    Re: Clear data from text file

    The data in the file only has numbers and letters.
    I want to remove all that data.
    Thank you.

  5. #5
    Forum Contributor tax112's Avatar
    Join Date
    02-28-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2016 | 2019
    Posts
    438

    Re: Clear data from text file

    I have a solution for my problem.
    HTML Code: 
    Now I want to delete the data of many Text Files with the same folder, how do fix the code?
    Last edited by tax112; 07-12-2019 at 11:10 PM.

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow


    Just read this

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Clear data from text file

    Marc - I think a sample code snippet based on the OP's code would help, don't you? I know you think everyone should work everything out for themselves, but a little bit of guidance along the way would not go amiss.

    How would the OP incorporate the KILL statement into their code? As a VBA learner myself, I'd like to know, too. I am sure it will only take you a moment to demonstrate it to us. Worked examples are always the best approach to teaching and I know this because teaching is my profession.
    Last edited by AliGW; 07-13-2019 at 06:17 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,912

    Re: Clear data from text file

    Kill will delete the file entirely and from what I understand you simply want to erase data, not delete files.

    One way to do that is using the FilesystemObject.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,483

    Re: Clear data from text file

    Rudi - thank you for the clarification and the helpful contribution.

  10. #10
    Forum Contributor tax112's Avatar
    Join Date
    02-28-2013
    Location
    Thailand
    MS-Off Ver
    Excel 2016 | 2019
    Posts
    438

    Re: Clear data from text file

    Quote Originally Posted by bakerman2 View Post
    Kill will delete the file entirely and from what I understand you simply want to erase data, not delete files.

    One way to do that is using the FilesystemObject.

    Please Login or Register  to view this content.

    Excellent!
    Thank you very much.

  11. #11
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,912

    Re: Clear data from text file

    You're welcome and thanks for rep+.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy data from txt file to excel file then delete text file
    By gratedane8 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-11-2018, 07:36 PM
  2. [SOLVED] Avoid One Text Box from clear data
    By sijostephen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2017, 11:11 AM
  3. "clear data" and reset page length/file size
    By ahalliwell in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2017, 12:34 PM
  4. Create folder, excel file, pdf file, clear details macro
    By cemartinho in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2013, 08:52 AM
  5. Replies: 1
    Last Post: 06-21-2013, 04:05 AM
  6. Clear Data on first time opening file
    By jghender in forum Excel General
    Replies: 1
    Last Post: 01-16-2013, 03:47 PM
  7. Charting file template to clear old data, paste new data and update chart
    By cwilliams321 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 05-29-2012, 04:13 PM

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