Overlapping in Paste

Sharkie21

Active Member
Joined
Nov 2, 2005
Messages
319
So far I got all my chart objects to copy and paste into word. However when I paste into word it just paste one ontop of the other. I want it to paste one after the other, but it doens't work :oops:

This is my code:

Code:
Public Sub ExportExcelGraph(wdObj As Word.Application, wdDoc As Word.Document)

Dim PC As ChartObject
Dim Wsht As Worksheet
On Error GoTo ErrHandler
For Each Wsht In ThisWorkbook.Worksheets
For Each PC In Wsht.ChartObjects
    PC.Activate
    ActiveChart.ChartArea.Select
    ActiveChart.ChartArea.Copy
    wdObj.Selection.PasteSpecial Link:=False, DataType:=wdPasteEnhancedMetafile, _
        Placement:=wdOneAfterAnother, DisplayAsIcon:=False
Next PC
Next Wsht

ErrHandler:
    Resume Next
End Sub
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
What you probably need to do is record a macro in Word when you move the charts to the desired position.

You should then be able to use that in your existing code.
 
Upvote 0
I'm using word 2000. When I do a paste special since I don't want the link the only other option is a metafile. I wouldn't mind writing a macros in word to do the spacing, but these don't seem to act like an ordinary picture. I can't put my cursor after it and it doesn't add a new page when room runs out. Why is that happening?
 
Upvote 0
I really have no idea.

In the past I've had nightmares with using charts/pictures in Word, even without usingg code.
 
Upvote 0
What I found out was if I copy multiple charts it'll add it to my clip board. And if I go to word and paste all, it's perfect. However, my clipboard will run out of room. Anyway to clear the clipboard with code and make it paste all with code?

According to the code to paste all it just does: selection.paste a bunch of times.

However, when I call this from word wdObj.selection.paste. It goes slow and keeps pasting the same chart over and over again even though there's 12 on the clipboard.
 
Upvote 0
1) Right click each picture
2) Choose Format Picture
3) Click the Layout tab
4) Make sure this is set to "In line with text"

This will allow you to position them one after another. Is that what you needed?
 
Upvote 0
OMG It works!!!!!!

I needed this line.

wdObj.Selection.ShapeRange.ConvertToInlineShape

Thank you Norie and TrippyTom!!!
 
Upvote 0

Forum statistics

Threads
1,214,897
Messages
6,122,141
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top