Sunday, 26 July 2015

How to Copy and Paste Excel Range as Picture in VBA

Excel VBA Macro to Copy an Excel Range as Picture and Pasting as Picture
Sub Copy_Paste_As_Picture()
'Method -I : Copying the Range as Picture and Pasting
'Selecting and Copying the Range
'ActiveSheet.Range(MyRange).Select

'Copying as Picture , Best Usage Method: This will copy the Range in Excel without Background
    Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture

'Copying as Bit Map Image Method: This will copy the Range in Excel with Background
    Selection.CopyPicture Appearance:=xlScreen, Format:=xlBitmap

'Copying as Picture Print Method:
    Selection.CopyPicture Appearance:=xlPrinter, Format:=xlPicture

    ThisWorkbook.Sheets("MyTab").Activate
    ActiveSheet.Range("A5").Select
    ActiveSheet.Paste
    
'Method - II : Copying the Range and Pasting as Picture
'Selecting and Copying the Range
ActiveSheet.Range(MyRange).Select
Selection.Copy

    ThisWorkbook.Sheets("MyTab").Activate
    ActiveSheet.Range("A5").Select

'Pasting as Picture
    ActiveSheet.Pictures.Paste
'Pasting as Picture with Source Link (The Source Tab & Range Address of the Image in Excel)
    ActiveSheet.Pictures.Paste(Link:=True).Select
    
End Sub

4 comments:

  1. Hi Tamatam,
    I used your code to export charts from excel slicer to PowerPoint and need help with exporting the chart and its related text for each slicer item. The text is in a range of cells. Can you please help guide me. Thanks

    Regards,
    Manjit.

    ReplyDelete
    Replies
    1. Hello Manjit Sir ,
      Thanks for Writing your query. Try the following Macro which may helps You :
      http://excelkingdom.blogspot.in/2014/09/how-to-generate-power-point.html

      Delete
  2. Hi Tamatam,
    This is again a good post. I was hoping you can help me with a work project I have. I have been able to use your code to export charts associated with each excel slicer to PowerPoint. What I also need is to export the associated text for the slicer. I have created a pivot table to get text sorted and have linked the cells on the dashboard to change with the slicer as the graphs change. I am having trouble exporting the slides with the text. Any help you can provide is much appreciated. Thanks

    Manjit.

    ReplyDelete
    Replies
    1. Hello Manjit Sir ,
      Thanks for writing. Try the following Macro which may helps you : http://excelkingdom.blogspot.in/2014/11/how-to-copy-and-print-each-named-range.html

      Delete

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts