+ Reply to Thread
Results 1 to 14 of 14

Merging txt documents into one document

  1. #1
    Forum Contributor
    Join Date
    03-09-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    173

    Smile Merging txt documents into one document

    I have a macro that copies several textdocuments into one document. The problem is that it adds a little squared box in the beginning of each new document that is pasted. Anyone who knows what the reason is?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Merging txt documents into one document

    The little square is probably a carriage return, line feed, or end of document.

    You can determine what it is by copying it (ctrl+C). Go to the immediate window and type ? asc("*") (replace the * with what you copied (ctrl+v)). This will tell you the ascii of the character (let's say it is 10). Then in your macro :
    Please Login or Register  to view this content.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  3. #3
    Forum Contributor
    Join Date
    03-09-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    173

    Re: Merging txt documents into one document

    Hi,

    Thanks for your answer. I tried it.

    When I paste into immediate window its like hitting enter. It breaks the code into two pieces and it doesn't look like I have been pasting anything.

    The sign I want to move is a blank box.

    I also have a problem with blank lines between some of the documents. I believe the macro would run smoother if I had some kind of select all, copy and paste function.

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Merging txt documents into one document

    The sign I want to move is a blank box.
    Using the CLEAN function removes all non-printable characters

  5. #5
    Forum Contributor
    Join Date
    03-09-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    173

    Re: Merging txt documents into one document

    Good. What more than clean. "Clean (7)"?

  6. #6
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Merging txt documents into one document

    CLEAN(A1) is a worksheet function. I'm not versed in VBA but maybe this helps

  7. #7
    Forum Contributor
    Join Date
    03-09-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    173

    Re: Merging txt documents into one document

    But its a txt-document.

  8. #8
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Merging txt documents into one document

    I understood that you merged your docs in an XL sheet sorry

  9. #9
    Forum Contributor
    Join Date
    03-09-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    173

    Re: Merging txt documents into one document

    No prob.

    If the the macro was made to copy everything into excel, clean and remove blank lines, and then paste into a text document.

    I don't know how the code should be written.

  10. #10
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Merging txt documents into one document

    Does this link help ? http://www.rondebruin.nl/csv.htm

  11. #11
    Forum Contributor
    Join Date
    03-09-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    173

    Re: Merging txt documents into one document

    I didn't get much out of it.

  12. #12
    Forum Contributor
    Join Date
    03-09-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    173

    Re: Merging txt documents into one document

    Anyone who knows? Or do you all have summervacation?

  13. #13
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Merging txt documents into one document

    Hi Hjahren;

    Try this:
    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    03-09-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    173

    Re: Merging txt documents into one document

    It didn't work... still having the same problem. the macro didn't run with that command

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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