Hi!
I am trying to run the following in Excel 2013, but it won't work, I get run-time error "2147188160 Shapes.Paste: Invalid Request" and it is the blue line below which appearently is creating the problem. The macro worked perfectly in Excel 2010. However, now that I have had the file open in Excel 2013, it will no longer work when I go back to Excel 2010. So can anyone help me resolve this problem? Either assist me in getting the macro to work in Excel 2013 or help me getting the file to work again in Excel 2010. Thanks!
****
Sub insert_chart()
Set objpowerpoint = New PowerPoint.Application
For I = 1 To 22
Sheets("fabrik").Select
Range("b26").Select
ActiveCell.Offset(I, 0).Select
bild = ActiveCell.Value
Range("c26").Select
ActiveCell.Offset(I, 0).Select
bildobj = ActiveCell.Value
Range("a26").Select
ActiveCell.Offset(I, 0).Select
Slide = ActiveCell.Value
Range("d26").Select
ActiveCell.Offset(I, 0).Select
pict_height = ActiveCell.Value
Range("e26").Select
ActiveCell.Offset(I, 0).Select
pict_width = ActiveCell.Value
Range("f26").Select
ActiveCell.Offset(I, 0).Select
pict_tb = ActiveCell.Value
Range("g26").Select
ActiveCell.Offset(I, 0).Select
pict_lr = ActiveCell.Value
Application.Goto Reference:=bild
If bildobj = 1 Then
ActiveSheet.ChartObjects(bild).CopyPicture xlScreen, xlPicture
ElseIf bildobj = 2 Then
ActiveSheet.Shapes(bild).CopyPicture xlScreen, xlPicture
Else
ActiveSheet.Range(bild).CopyPicture xlScreen, xlPicture
End If
objpowerpoint.ActivePresentation.Slides(Slide).Select
With objpowerpoint.ActivePresentation
Set opicture = .Slides(Slide).Shapes.Paste
opicture.Height = pict_height
opicture.Width = pict_width
opicture.Left = pict_lr
opicture.Top = pict_tb
End With
Next I
End Sub
****
I am trying to run the following in Excel 2013, but it won't work, I get run-time error "2147188160 Shapes.Paste: Invalid Request" and it is the blue line below which appearently is creating the problem. The macro worked perfectly in Excel 2010. However, now that I have had the file open in Excel 2013, it will no longer work when I go back to Excel 2010. So can anyone help me resolve this problem? Either assist me in getting the macro to work in Excel 2013 or help me getting the file to work again in Excel 2010. Thanks!
****
Sub insert_chart()
Set objpowerpoint = New PowerPoint.Application
For I = 1 To 22
Sheets("fabrik").Select
Range("b26").Select
ActiveCell.Offset(I, 0).Select
bild = ActiveCell.Value
Range("c26").Select
ActiveCell.Offset(I, 0).Select
bildobj = ActiveCell.Value
Range("a26").Select
ActiveCell.Offset(I, 0).Select
Slide = ActiveCell.Value
Range("d26").Select
ActiveCell.Offset(I, 0).Select
pict_height = ActiveCell.Value
Range("e26").Select
ActiveCell.Offset(I, 0).Select
pict_width = ActiveCell.Value
Range("f26").Select
ActiveCell.Offset(I, 0).Select
pict_tb = ActiveCell.Value
Range("g26").Select
ActiveCell.Offset(I, 0).Select
pict_lr = ActiveCell.Value
Application.Goto Reference:=bild
If bildobj = 1 Then
ActiveSheet.ChartObjects(bild).CopyPicture xlScreen, xlPicture
ElseIf bildobj = 2 Then
ActiveSheet.Shapes(bild).CopyPicture xlScreen, xlPicture
Else
ActiveSheet.Range(bild).CopyPicture xlScreen, xlPicture
End If
objpowerpoint.ActivePresentation.Slides(Slide).Select
With objpowerpoint.ActivePresentation
Set opicture = .Slides(Slide).Shapes.Paste
opicture.Height = pict_height
opicture.Width = pict_width
opicture.Left = pict_lr
opicture.Top = pict_tb
End With
Next I
End Sub
****