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 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)


Copying - Range

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)


Word Pasting - Chart or Range

This pastes a chart (or range) as a Picture into Word.

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

Link - Whether to create a link to the source file (default is False)
Placement - The type of placement for the object, either inline or floating)
DisplayAsIcon - Whether to display the link as an icon (default is False)
DataType - The format to use when the item is inserted
This pastes a chart (or range) as a Linked Object into Word.

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

PowerPoint Pasting - Chart or Range Linked

This pastes a chart (or range) as a Picture into PowerPoint.


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

DataType - The format to use when the item is inserted
This pastes a chart (or range) as a Linked Object into PowerPoint.

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

ActiveChart.Copy

Copies a Chart Sheet to another location in the workbook.
This can only be used when you use Chart Sheets. It cannot be used with embedded charts.
If you do not provide either Before or After then the Chart Sheet is copied to a new workbook.

ActiveChart.Copy Before:=Worksheets("Sheet1") 
ActiveChart.Copy After:=Worksheets("Sheet1")

Before - The sheet before your chart sheet.
After - The sheet after your chart sheet.


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