I have been using this code to copy across a number of ranges and charts. However as my code has grown it appears to fall over, having googled around the issue i think it is caused by the chart/range not correctly being copied to/from the clipboard cache. Is there a way to avoid this error?
Error - " Run-time error '-2147188160 (80048248)': Shapes.PasteSpecial :Invalid request. Clipboard is empty or contains data which may not be pasted here"
Public Sub CopyPasteHeadcountTopGraph()
If PPT Is Nothing Then Exit Sub
If PPT_pres Is Nothing Then Exit Sub
Dim rng As Range
Dim mySlide As Object
Dim myShape As Object
Dim cht As Chart
Set mySlide = PPT_pres.Slides(6)
With mySlide
.Select
Set cht = ThisWorkbook.Worksheets("Headcount").ChartObjects("HcChart").Chart
cht.CopyPicture Appearance:=xlScreen, Format:=xlPicture, Size:=xlScreen
.Shapes.Paste.Select 'ERROR HERE
'''''''''''''''''''''''''''''''''
'Paste as Chart and break link. '
'''''''''''''''''''''''''''''''''
'cht.ChartArea.Copy
'.Shapes.Paste.Select
'With .Shapes("HcChart")
'.LinkFormat.BreakLink
'End With
PPT_pres.Windows(1).Selection.ShapeRange.Left = 35
PPT_pres.Windows(1).Selection.ShapeRange.Top = 110
PPT_pres.Windows(1).Selection.ShapeRange.Width = 655
PPT_pres.Windows(1).Selection.ShapeRange.Height = 300
End With
'Clear The Clipboard
Application.CutCopyMode = False
Application.Wait (Now + TimeValue("00:00:01"))
End Sub