Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Posts
    126

    Unanswered: Copy txt files into one txt file

    Hi ya!

    I want to make an import file that is a txtfile.

    I want to take multiple txt files and copy them into one file using vba...

    In dos you can do copy txt1.txt + txt2.txt combined.txt and it will copy the first two files into the last.

    Using FileCopy you can only copy one file, as it overwrites the destination.

    Any ideas???

    Thanks!

    Ken

  2. #2
    Join Date
    Jan 2003
    Location
    Aberdeen, Scotland, UK
    Posts
    168
    it's quite a crude method, but it's quick and easy.

    Just use a dos shell.

    Raw but effective.

  3. #3
    Join Date
    Jan 2003
    Posts
    126
    How would I pass it the copy command?

  4. #4
    Join Date
    Jan 2003
    Posts
    126
    This works like a charm:

    Code:
    RunThis = "cmd /k copy c:\test\1.txt + c:\test\2.txt  c:\test\shelltest.txt"
    
    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Run RunThis, 3, False
    Thanks again for the help guys!

    Ken

Posting Permissions

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