PDA

View Full Version : Solved: Macro to copy from word to word



hunsnowboard
10-12-2009, 08:08 AM
Hi there Everyone. With the help of this site, a few months ago I made a macro which transferred some bookmarks from a Word file to an Excel file. That macro is still working and it was a great help for me. Thank You again for that. But now the situation is different, and I really do not know how to get started. Here is the problem:

I have a very detailed word file with a lot of information (let's call it file A). Then there is a another word file (file B) which is a brief file of file A. File A has many many rows, file B has only a few rows. File B contains only the main and most important information of file A.

So far I made everything manually. I wrote file A, then copy paste the most important parts to file B. Now I thought I should try to automate this procedure with the help of a macro which will take the relevant information from file A and paste it in the given bookmarks of file B.

My problem is that I really do not know how to do it. File A has no bookmarks. How will word know which information to copy. This could be solved by those bookmarks? Should I make the relevant part as bookmarks and then try to transfer it?
I know that this question sounds stupid but I really have to start from somewhere. Thank You in advance!

macropod
10-12-2009, 03:20 PM
Hi hunsnowboard,

You may be able to do what you want without a macro.

If you bookmark the various ranges in Doc A that you want replicated in Doc B, you can use INCLUDETEXT fields in Doc B to link the contents of the two documents. That way, any changes to the bookmarked contents in Doc A will update Doc B. Not only that, but you can edit the linked content in Doc B also and have those changes incorporated into Doc A by selecting the edited range in doc B and pressing Ctrl-Shift-F7.

See Word's help file for more details.

hunsnowboard
10-13-2009, 01:39 AM
Hi macropod! Thank You very much for this suggestion! It seems that it will make things much easier for me! Thank You!

By the way, there is another small problem, related to one of my other macros....

I have the following command in my macro:

.bookmarks ("iktatosz").Range.Text = iktsz.value

My problem is that I would like this text to be bold in the document. (I get the value from the UserForm). How can I make it to be bold?

Thank You very much in advance!

macropod
10-13-2009, 01:52 AM
Hi hunsnowboard,

For the font bolding:

With .Bookmarks("iktatosz").Range
.Text = iktsz.Value
.Font.Bold = True
End With

hunsnowboard
10-13-2009, 09:32 AM
Thank you very much again! :) It is working! (I hoped that there might be a one row solution but this is just as good!) Thank you again!