Copying

Excel > Cells & Ranges > VBA Code > Copying
Excel > Illustrations > VBA Code > Copying
Word > Paragraphs > VBA Code > Copying


Chart Object

this will copy the active embedded chart (for a linked chart)

ActiveChart.Copy 

this will copy the active embedded chart as a picture

ActiveChart.CopyPicture Appearance:=xlPictureAppearance.xlScreen, _ 
                        Format:=xlCopyPictureFormat.xlPicture, _
                        Size:=xlPictureAppearance.xlPrinter, _

Appearance - Specifies how the picture should be copied (default is xlScreen)
Format - The format of the picture (default is xlPicture)
Size - The size of the picture when the object is a chart on a chart sheet (default is xlPrinter)


Range Object

this will copy the cell range (for a linked range)

Selection.Copy 

this will copy the cell range as a picture

Selection.CopyPicture Appearance:=xlPictureAppearance.xlScreen, _ 
                      Format:=xlCopyPictureFormat.xlPicture

Appearance - Specifies how the picture should be copied (default is xlScreen)
Format - The format of the picture (default is xlPicture)


Pasting - Chart or Range

this pastes a chart as a picture

objWord.Selection.PasteSpecial Link:=False, _ 
                               Placement:=wdOLEPlacement.wdInLine, _
                               DisplayAsIcon:=False, _
                               DataType:=wdPasteDataType.wdPasteEnhancedMetafile

objPowerPoint.ActiveWindow.View.PasteSpecial DataType:=ppPasteDataType.ppPasteEnhancedMetafile

Pasting - Chart or Range Linked

this pastes a linked chart

objWord.Selection.PasteSpecial Link:=True, _ 
                               Placement:=wdOLEPlacement.wdInLine, _
                               DisplayAsIcon:=False, _
                               DataType:=wdPasteDataType.wdPasteOLEObject

objPowerPoint.ActiveWindow.View.PasteSpecial DataType:=ppPasteDataType.ppPasteEnhancedMetafile

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext