PDA

View Full Version : Excel 2016 .CopyPicture



fb7894
01-13-2018, 10:47 AM
Hello. We have an existing macro that has run successfully for years on Excel 2010. The macro creates charts, copies pictures of the charts to another tab.

We upgraded to Excel 2016 last week. And the following line of code now works incorrectly. It only copies part of the range.

rRange_To_Copy.CopyPicture xlScreen, xlPicture


Has anyone else experienced this? Is there a work around?

Thanks!

Paul_Hossler
01-14-2018, 10:52 AM
Not sure I completely understand, but this works in 2016





Option Explicit

Sub test()
Dim rRange_To_Copy As Range

Set rRange_To_Copy = ActiveSheet.Range("A1:C3")
rRange_To_Copy.CopyPicture xlScreen, xlPicture

Worksheets("Sheet2").Select
Range("D4").Select
ActiveSheet.PasteSpecial Format:="Picture (Enhanced Metafile)", Link:=False, DisplayAsIcon:=False

End Sub