locked
Macro for Access to remove headers from multiple text documents? RRS feed

  • Question

  • I have a database that imports around 100 text documents a day that are saved as .BKP. The problem is sometimes the system that exports them puts a "header" of gibberish that needs to be deleted individually from each document before it is imported. This is time consuming. The database predates my employment so I don't know too much about it unfortunately.

    I'm sure there is a macro or script that can be created to do this quicker, I just can't seem to figure it out.

    Within each document I need to delete everything before the word "START". Example:

    "GI BBE RISH RANDOM GIBBERISH START important stuff I need to keep."

    -To-

    "START important stuff I need to keep."

    From a folder with around 100 or so of these. The files look like this:

    546532131.BKP

    687987896.BKP

    321654646.BKP

    I'd prefer to do this from access itself but if there any other quick solutions that don't require third-party software, that would be fine.

    Some more info:

    Access 2013

    The file names and the gibberish are always different.

    The files are Read-Only which I have to change before editing manually.

    The .BKP extension can be changed to .TXT without any format issues, but needs to be changed back to .BKP before import

    Wednesday, June 6, 2018 1:43 PM

All replies

  • Hi,

    Based on your description, I will move your thread to Access for Developer forum:

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=accessdev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Regards,

    Emi


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Thursday, June 7, 2018 1:51 AM
  • Hi,

    This should be doable in Access. But first, what does your import routine looks like? Maybe you can modify it to handle the removal of the headers.

    Just a thought...

    Thursday, June 7, 2018 2:30 AM
  • Hello UsMeyer,

    How do you import these BKP file? Since the gibberish are different, how could we consider a string in gibberish? In your example, they are even the same line with the important stuff you need to keep.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, June 7, 2018 8:45 AM