View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Excel 2007/Vista - PastePicture Problem

It's not related to Vista but it seems in Excel 2007 with CopyPicture,
whether the format set to Bitmap or Metafile, only a metafile gets copied to
the clipboard, not useful at all.

In a quick test a workaround that seems to work is simply copy, literally
"copy", eg

ActiveChart.Chartarea.Copy
or
ActiveSheet.ChartObjects(1).Chart.ChartArea.Copy

If you do that both formats will be copied to the clipboard, then take your
pick.

Regards,
Peter T



"Nick H" wrote in message
...
Has anyone found a way to get Stephen Bullens PastePicture code...
http://www.oaltd.co.uk/Excel/Default.htm
...to work in Excel 2007?

It does an excellent job for me in an app that I developed in Excel
2003 but falls over in 2007. Or is it perhaps the fault of the Vista
user32.dll?

I have two machines, one running Office 2003 on XP the other running
Office 2007 on Vista. On the Vista machine when the
IsClipBoardAvailable function is passed an xlBitmap type it returns 0.
As a result PastePicture returns nothing. I can get it to work if I
pass the the argument as xlPicture and save it as a .emf but I need
a .bmp because I then want to load the picture into a control.

The problem can be demonstrated by running Stephen's PastePicture.xls
example workbook. On my Vista/Excel 2007 machine the chart picture
only displays if the picture type is set to Metafile on the demo form.

Br, Nick