Cannot copy Excel 2007 Chart and Paste as Bitmap into Powerpoint 2

  • Thread starter Thread starter SysMod
  • Start date Start date
S

SysMod

A client with a Mac complains that my chart pictures in Powerpoint are
distorted.
The text appears badly spaced. My guess is the Mac does not like the MS
Metafile picture type.

My code has:
ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen,
Format:=xlPicture
Set PasteSlideShape = mPPSlide.Shapes.PasteSpecial(PasteDataType)
where I have tried all values of 0..11 for the DataType parameter
But I get for type 2 (bitmap)
'Run-time error '-2147188160 (80048240)':
'Shapes (unknown member) : Invalid request. The specified data
type is unavailable.

only datatypes 0,2,3 work. I use 0 (default, which is the same as Metafile)


I've googled for this and got these refs:

Excel 2007 copy chart as bitmap cannot paste as ppBitMap into Powerpoint 2007
http://www.pcreview.co.uk/forums/thread-3883121.php
PasteSpecial of Device Independent Bitmap with VBA in PP2007

in the full list of Excel 2007 SP2 fixes we see :
The VBA method Selection.CopyPicture does not copy the bitmap picture format
to the clipboard.

Excel..About says I have SP2


http://www.ozgrid.com/forum/showthread.php?t=73114
Re: Picture Copied as BitMap Ends Up As Metafile
Andy Pope says: "For me in 2007 this code copies the chart as a bitmap and
pastes into powerpoint as expected."
ActiveSheet.Shapes(1).CopyPicture Appearance:=xlScreen, Format:=xlBitmap
objPPTSld.Shapes.PasteSpecial ppPasteBitmap

but I get the error as shown above.

Any ideas?

TIA

Patrick
 
Excel 2007 charts look like crap when exported as metafiles. Change
CopyPicture so it copies the chart as a bitmap. In either case you only
need to paste regular in PowerPoint.

- Jon
 
Jon Peltier said:
Excel 2007 charts look like crap when exported as metafiles. Change
CopyPicture so it copies the chart as a bitmap. In either case you only
need to paste regular in PowerPoint.

I did that John, the client says they look just the same.
I tried all six combinations of
chart.copypicture with xlbitmap and xlpicture
and
slides.pastespecial with datatypes 0,2,3

' 0 ppPasteDefault
' 1 ppPasteBitmap
' 2 ppPasteEnhancedMetafile
' 3 ppPasteMetafilePicture ' same as default, truncated if too wide
' 4 ppPasteGIF
' 5 ppPasteJPG

I can indeed only paste regular (default) in Powerpoint 2007, get error if I
use bitmap datatype.

Thanks,

Patrick
 
Jon,

I've done more tests. Here is the new code with an extra step / workaround
/ kludge.

ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen,
Format:=xlPicture

' for the Shape tests, convert it to a picture in Excel first then copy it,
so the other formats become available except 7,8,9

ActiveSheet.Paste ' will delete this copy shape later below

' have to do this to get the shape because activesheet.paste returns boolean

Set shp = ActiveSheet.Shapes(ActiveSheet.Shapes.Count)

shp.copy

mPPSlide.Shapes.PasteSpecial(PasteDataType)

I can't embed images here AFAIK but if you want samples I can email them to
you

I'll check whether the blurry effect on the text labels in the chart is from
resizing but at the moment ppPasteBitmap is best, PNG is usable. OTOH 2,3,10
look best in Windows so they'll have to choose what they want !


' PpPasteDataType: Mac text effect
' 0 ppPasteDefault broken
' 1 ppPasteBitmap good, a little fuzzy
' 2 ppPasteEnhancedMetafile broken
' 3 ppPasteMetafilePicture broken
' 4 ppPasteGIF bold, most blurry
' 5 ppPasteJPG bold, medium blurry
' 6 ppPastePNG bold, less blurry
'10 ppPasteOLEObject badly broken
'11 ppPasteShape badly broken

7,8,9 are text data formats, not applicable here


Thanks,

Patrick
 
Now that you mention it, in a client project I had to copy as picture
using bitmap format, paste into Excel, copy this pasted picture, then
regular paste into PowerPoint.

And while I said bitmaps in 2007 were better than metafiles, they still
look awful.

- Jon
 
It also may return the wrong shape in 2007 if you have any controls on
the sheet. 2003 treats all shapes the same, at least in terms of
stacking order and order in the collection of shapes, but 2007 has
different hierarchies of shapes, and it can make you cry.

- Jon
 
Back
Top