How to copy pictures in Excel and paste them under a Word bookmark

B

Bon

Hello all

I have to implement a Word VBA which can copy pictures from MS Excel
2000 and then paste them under a Word bookmark.

I know how to copy a picture in MS Excel Worksheet to the clipboard and
then paste it under a Word bookmark. My code is as below:

Set xlWorkbook = xlApp.Workbooks.Open(FileName:=WorkbookToWorkOn)
Set xlWorksheet = xlWorkbook.Worksheets("Report1")
xlWorksheet.Range("A1:O50").Copy

ActiveDocument.Bookmarks("Report").Range.PasteSpecial link:=False,
DataType:=wdPasteMetafilePicture

But, how can I copy pictures in Excel and paste them under a Word
bookmark. I also have some conditions on determing which pictures have
to copy and paste them in workd.

Please give me some advices

Thanks
Bon
 
W

Word Heretic

G'day "Bon" <[email protected]>,

I must be missing something. You are stating you know how to do
something, then asking how to do it?


Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Bon reckoned:
 
B

Bon

Sorry, I should state my question clearly.

Yes. I know how to copy one picture and paste them under word bookmark.
But, I need to copy several pictures and paste them under a bookmark.
The format is as follow:

Picture A title
Picture A
--New Page--
Picture B title
Picture B
--New Page--
Picture C title
Picture C

Thanks

Cheers
Bon
Word Heretic 寫é“:
 
W

Word Heretic

G'day "Bon" <[email protected]>,

ahhhh. There are two ways here. First is to recreate the bookmark
after placing each picture - word.mvps.org/FAQs on that LOVELY little
feature.

Second, is to assign the bookmark's range to your own range object,
and use that range for inserting. Keep collapsing the range to its end
between picture insertions.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Bon reckoned:
 
B

Bon

Thanks Steven.

I use the first method you provided. It works great. Thanks.

I have to auto number the pictures as well. What methods I should use?

If Picture A exists Then
Picture A
Paste Picture
--New Page--
Else If Picture B exists Then
Picture B
Paste Picture
--New Page--
....

How can I auto number the pictures and insert it in front of the
pictures?

Thanks

Bon
 
W

Word Heretic

G'day "Bon" <[email protected]>,

Define a numbered Caption style and insert a para of that before the
table. Your tables will all autonumber perfectly.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Bon reckoned:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top