![]() |
|
|
|
#1
|
|||
|
|||
|
Would anyone tell me how to get image from bookmark1 in document1 and paste this image to bookmark2 in Document2 ? |
|
#2
|
|||
|
|||
|
You can do it using the formattedtext method:
Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oDoc1 As Document, oDoc2 As Document
Set oDoc1 = Documents(1)
Set oDoc2 = Documents(2)
oDoc1.Bookmarks("TargetBMName").Range.FormattedText = oDoc2.Bookmarks("SouceBMName").Range.FormattedText
lbl_Exit:
Exit Sub
End Sub
|
|
#3
|
|||
|
|||
|
Dear Grey Maxey
Thanks for your kind help. But how to remain bookmark "TargetBMName" after execute your marco? |
|
#4
|
|||
|
|||
|
What do you mean, "How to remain bookmark ....?
I don't what your bookmarks are actually named and the code was just an example. The idea is that you have two documents e.g., Doc A and Doc B and each has a named bookmark. The code sets the formatted text content of one as the formatted text content of the other. |
|
#5
|
|||
|
|||
|
Dear Grey Maxey
I am sorry to have confused you. I make some wrong steps in my macro led to overwrite the target bookmark in Doc2. |
|
#6
|
||||
|
||||
|
In document 2, go to Insert|Object>Text from File, select the file, then insert the bookmark name in the 'Range' box. With this approach, any changes to the bookmarked image in document 1 will be reflected in document 2.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#7
|
|||
|
|||
|
Dear Paul
I really appreciate your help. |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Pasting Image inside Table and Resize Image Not Working
|
Grahamers2002 | Drawing and Graphics | 5 | 07-02-2018 04:49 PM |
| Find Bookmark, move to bookmark, execute code, repeat | raymm3852 | Word VBA | 10 | 04-15-2016 06:21 PM |
Bookmark not replaced when inserting but to lower right corner of image
|
newbieX | Word VBA | 6 | 11-20-2015 02:03 PM |
Bookmark Not Showing Bookmark
|
RegAudit | Word | 6 | 03-16-2015 11:08 PM |
TOC: Link to bookmark or image
|
Mijin | Word | 2 | 09-22-2011 03:14 AM |