Update VBA Code to Include Parameter for Delimiter, File Location and Overwrite Sheets when Re-Run

  • Excel Version = 365

    OS = Windows

    Good Day,

    I'm sure this question has been posted a thousand times and there are tons on this on Google, but I just can't find the right piece of code I need.

    I don't know VBA at All so Apologies if I ask a lot of dumb obvious questions.

    Short Description of what is needed:

    I have Software that writes out Text Files to a Specific Folder on the Local HDD. These Text Files all have Unique Names and use " | " as a Delimiter.

    Each Day when the User clicks the Button, These Text Files must be Imported into the Same Workbook the Code is Run from, Each Text File on it's Own Worksheet.

    If the Button is Pressed Again, the Text Files are Imported Again and must Overwrite the Worksheet with the Same Name, not Create a New Worksheet, Thus Asset Text File will each time overwrite the Worksheet Named Asset etc.

    I found this Code that does the Importing and Creates the Worksheets per File Name:

    But I need the Following Add:

    1. Option the Specify which Delimiter to Use.

    2. Option to Specify the Folder Location so that the User doesn't have to Choose it each time, the code must automatically import the files from the Folder Location Supplied.

    3. When the Code is Run Again, just Overwrite the Worksheet with the same name, not create a New Worksheet.

    Any Help or Suggestions will be Greatly Appreciated.


    Edited once, last by alansidman: Added Code Tags ().

  • Possibly...

    If I've been helpful, let me know. If I haven't, let me know that too. 

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!