+ Reply to Thread
Results 1 to 3 of 3

Text from one .doc to another .doc

  1. #1
    Registered User
    Join Date
    01-12-2010
    Location
    Seychelles's Beach
    MS-Off Ver
    Excel 2003
    Posts
    8

    Text from one .doc to another .doc

    Hi

    I have been using MS Word for ages, actually only for basic functions, didn't discover a lot in it. Never asked on any microsoft office's forum a question about it until now when I have to.

    I need to move (only move, not change!) entire (100% of the text) text from one .doc file to another .doc. I would like to do this process automated. So when I click on some file, it automatically do this. But its not so easy as it sounds. The target .doc file (file, into which i want the text to be moved) is not the only one but can be many of them. All the target .doc files are always in the same folder (same path) but all of them don't have the same name. The .doc file FROM where I want to move entire text is only one, always in the same folder (same path) and always with the same file name.
    Names of the target are only similar but as I have said before, not the same. Here is the point:

    Target .doc files have the names:
    HD1.doc
    HD2.doc
    HD3.doc
    HD4.doc
    and so on

    What I would like to have is moved the entire (but really all of the text, must be 100% all) text into the .doc file with the highest ( ! ) number (in example above, into HD4.doc). The target .doc files will always start with ''HD'' and always be similar to above examples.

    It is possible that the doc file (target file) is only one, so only HD1.doc. Therefore ''1'' is the maximum number and the text is moved into this file.

    Sometimes the target file is empty but usually won't be. If it won't be then the text should be moved to the end of the text, into first new line (no empty lines inbetween).

    So for example in the target file which has the maximum number in its name is the following text:

    a
    b
    c

    In the file from which I want to move the text is:

    d

    This means I need in the target file this:

    a
    b
    c
    d

    Is this possible to be done?

    Thank you, best wishes.

  2. #2
    Registered User
    Join Date
    01-12-2010
    Location
    Seychelles's Beach
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Text from one .doc to another .doc

    hello?

  3. #3
    Registered User
    Join Date
    11-09-2008
    Location
    germany
    Posts
    74

    Re: Text from one .doc to another .doc

    I see nobody has replied to your post. I do not like that so i thought I would give you some tips, but I am not going to spoon feed you with code. If you get some code but cannot get it to work post it back here and I will help you.

    To answer your question all of what you want you can do with VBA by creating a macro. Once you have this macro created you can add it to your Word tool bar and it will then run for you when you click it.

    The biggest tip I can give you and it is what I use often is when you want to do something in Word, then start the macro record and do it. Then stop the record and see what was recorded. This is going to give you a big hint on what to use.


    Open a new document in word and put any thing you like on it.

    Open your vb editor and cut and copy this

    Please Login or Register  to view this content.
    Then go back to your document and go tools>macro>macros and then click on myfirstsub. Then click run.

    Now open a new document and in the new document just edit>paste.

    Everything from the first document was copied and then you can paste it.

    Now have a go at extending your code. Do a little googleing how to open an existing document.

    Once you have the existing (your target document open) try to past the range into it.

    Once you have this we will then work on you choosing the right document. We will also work on where in the document exactly you have to paste the information.

+ 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