How to copy and paste as an image with VBA?

3

I need to copy a graphic and paste it as an image on the same worksheet.

I'm trying to select the range that contemplates any special graphics and paste as a Bitmap or Enchanced file. Here is the code:

Range("AM18:BE22").Select
 Selection.Copy
Application.CutCopyMode = False
Selection.Copy

With Sheets("Relatório").Range("CV18:DM22")
.PasteSpecial DataType:=wdPasteMetafilePicture

End With

And error 1004, Application or object definition error occurs.

Can anyone help?

    
asked by anonymous 03.11.2017 / 17:43

1 answer

0

Try this code, in this case you will copy the index graph 1. If there are more graphics, change the index number of ChartObjects .

The CopyPicture Method will be used, occurs that you need to copy the graphic object and not the range it is inserted.

Planilha1.ChartObjects(1).Chart.CopyPicture
Planilha2.Paste Planilha2.Range("CV18:DM22")

To declare which worksheet is being used, change the values of Planilha1 and Planilha2 . If you have any difficulties, please refer to this link .

    
06.11.2017 / 11:53