It appears that the VBA argument "xlBitmap" in Excel 2007 doesn't function as it should
If I manually copy an embedded chart (or a range that includes data cells and an embedded chart) using Copy as Picture and select "As Shown on Screen" and "As Bitmap," the item copied to the clipboard is, indeed, a bitmap. If i perform the exact same action in VBA using
,Code:Selection.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
then the item copied to the clipboard in NOT a bitmap, but a metafile.
I have macros that copy numerous charts and ranges as pictures and pastes them in powerpoint as pictures, but in XL07, the are always being copied as metafiles and ppt errors out if I use thevba function.Code:PPSlides.Shapes.PasteSpecial(ppPastebitmap)
I would use the metafile format, but in Office 2007, they are a mess. I was hoping to copy and paste as bitmaps, but it's not working.
Anyone else observed this bit of strangeness? Or is it just me?
For me in 2007 this code copies the chart as a bitmap and pastes into powerpoint as expected.
[vba]Sub x()
' include reference to Powerpoint library 12
Dim objPPT As PowerPoint.Application
Dim objPPTPres As PowerPoint.Presentation
Dim objPPTSld As PowerPoint.Slide
Set objPPT = CreateObject("Powerpoint.application")
objPPT.Visible = True
Set objPPTPres = objPPT.presentations.Add
Set objPPTSld = objPPTPres.Slides.Add(Index:=1, Layout:=ppLayoutText)
ActiveSheet.Shapes(1).CopyPicture Appearance:=xlScreen, Format:=xlBitmap
objPPTSld.Shapes.PasteSpecial ppPasteBitmap
End Sub
[/vba]
Cheers
Andy
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks