+ Reply to Thread
Results 1 to 6 of 6

VB Code to merge txt file

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB Code to merge txt file

    Hello:

    I need to merge the txt files as follows.

    Example: Currently I have txt files in C:\Temp\ 01_May17_Store1,02_May17_Store2,03_May17_Store3 as attached.
    I also have attached txt file called Merge.txt

    I need VB Code to copy line #5 thru Line # 64 from each of the Files in at C:\Temp\: 01_May17_Store1,02_May17_Store2,03_May17_Store3 and paste
    it at Line#5 of Merge.txt file and then save this Merge.txt file as May17_Merge.txt. (Note May17 needs to be from character 4 thru 8 of 01_May17_Store1.

    Please let me know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to merge txt file

    Hello:

    Attached is the Merge file i have done manually.
    Please let me know if you have any questions.
    Thanks.

    RIZ
    Attached Files Attached Files

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to merge txt file

    Hello:

    Would if any one has any confusion about this.
    Thanks

    Riz

  4. #4
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: VB Code to merge txt file

    Hi Riz,

    Put all the .txt files (including the "Merge.txt") in the sPath folder, then run the macro.
    An inputbox will popped up asking you for a date, then enter just the date alone (for example May17 , without space, without pre and post texts like 01,02,03,Store1,Store2, etc).

    Please Login or Register  to view this content.
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to merge txt file

    Hello karedog:

    Great, it works.
    Thanks a lot
    Riz

  6. #6
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: VB Code to merge txt file

    You are welcome Riz, thanks for the reps.

    Regards

+ 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. VBA Code to fetch files in a folder and merge into a "Master file" - Please assist!
    By ClarkKyle in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 05-24-2017, 04:14 AM
  2. Email merge from excel merge file using pre-saved word template
    By d_max_c in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2014, 12:33 PM
  3. VBA code to perform mail merge using text file
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2013, 04:46 AM
  4. VBA code to merge text file in a word document and print all the letters automatically
    By Rajbrinder in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2013, 08:25 AM
  5. Replies: 2
    Last Post: 01-22-2013, 11:37 AM
  6. Replies: 0
    Last Post: 11-03-2012, 09:10 PM
  7. Word Mail Merge and Name File (VBA Code Error)
    By wealthistime in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-14-2011, 03:47 AM

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