Help!

Cannot copy Excel 2007 Chart and Paste as Bitmap into Powe..

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Charting RSS
Next:  delete only visible rows in filter mode  
Author Message
SysMod
External


Since: Jul 10, 2009
Posts: 4



PostPosted: Tue Sep 29, 2009 3:54 am    Post subject: Cannot copy Excel 2007 Chart and Paste as Bitmap into Powerpoint 2
Archived from groups: microsoft>public>excel>charting (more info?)

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
Back to top
SysMod
External


Since: Jul 10, 2009
Posts: 4



PostPosted: Tue Sep 29, 2009 6:14 am    Post subject: Re: Cannot copy Excel 2007 Chart and Paste as Bitmap into Powerpoi [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
Back to top
Jon Peltier
External


Since: Feb 01, 2004
Posts: 179



PostPosted: Tue Sep 29, 2009 2:02 pm    Post subject: Re: Cannot copy Excel 2007 Chart and Paste as Bitmap into Powerpoi [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/



SysMod wrote:
> 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
>
Back to top
SysMod
External


Since: Jul 10, 2009
Posts: 4



PostPosted: Wed Sep 30, 2009 12:58 am    Post subject: Re: Cannot copy Excel 2007 Chart and Paste as Bitmap into Powerpoi [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks, Jon

That expression ActiveSheet.Shapes(ActiveSheet.Shapes.Count)

is awkward too, it would be easier to have a paste method that returns the
pasted object.

Anyway, it occurs to me (only now!) that this is really a Powerpoint
question. I'll ask in the PP Forums about what fonts are safe to use on both
PC and Mac so that the metafile pictures render correctly in both Windows and
Mac.

Regards

Patrick
Back to top
Jon Peltier
External


Since: Feb 01, 2004
Posts: 179



PostPosted: Wed Sep 30, 2009 10:58 am    Post subject: Re: Cannot copy Excel 2007 Chart and Paste as Bitmap into Powerpoi [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/



SysMod wrote:
> Thanks, Jon
>
> That expression ActiveSheet.Shapes(ActiveSheet.Shapes.Count)
>
> is awkward too, it would be easier to have a paste method that returns the
> pasted object.
>
> Anyway, it occurs to me (only now!) that this is really a Powerpoint
> question. I'll ask in the PP Forums about what fonts are safe to use on both
> PC and Mac so that the metafile pictures render correctly in both Windows and
> Mac.
>
> Regards
>
> Patrick
>
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Charting All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum