View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.charting,microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default Copy chart to clipboard - VBA

Size and format the chart appropriately before copying it, so you don't have
to do any formatting in the target application. Pick a size for the chart
(I'll use 2.5" by 3" in my description that follows). With the chart on its
own sheet (a chart sheet), change the margins so the chart fits the size you
designate. The paper is 8.5" tall by 11" wide, so you need two margins 3"
wide at the top and bottom, and two margins 4" wide at the left and right.
Now when copied and pasted the chart will be the correct size.

When you copy a chart as a chart, the chart itself is not copied. Instead,
Office merely keeps track of the reference of the chart. Office then
includes either the reference (if linked), or it actually copies the chart,
when you paste. So if you delete the chart, the reference is also deleted.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Fredrik E. Nilsen" wrote in message
...
On Sat, 21 Apr 2007 14:04:15 +0100, "Peter T" <peter_t@discussions
wrote:

Hi Fredrick,

can use the CopyPicture method
in stead, but then there will be a different size when pasted in
another application.


I just tried that and it worked fine for me after deleting the chart then
pasting into an image processor, having first running this recorded
macro -

ActiveChart.CopyPicture Appearance:=xlScreen, _
Size:=xlScreen, Format:=xlBitmap

If the other application is Word it may well resize.

Perhaps try different permutations of options when you do Shift Edit
CopyPicture...

You might also look into the Export method


Thanks for your reply Peter.

Your macro would work as you describe, but with this, the chart will
not have the size and formatting the users want. When pasted in Word,
all charts should ideally have the same size and the same formatting.
With CopyPicture, it takes the size of the screen (xlScreen). Thats
why I have to copy the chart sheet, paste it as an embedded chart into
a new sheet, resize and format it, copy the new chart to the
clipboard, delete the new sheet with the new chart.

Now, I want to be able to paste the chart into Word or PowerPoint, but
when the new sheet is deleted, so is the chart on the clipboard.

--
Fredrik E. Nilsen