Problems running VBA created in Excel 2010 in 2013 version

jenwer

New Member
Joined
Jul 2, 2015
Messages
3
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
****
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
try placing ActivePresentation or name of presentation in from of .Slides --> ActivePresentation.Slides(...)......
 
Upvote 0
I just tried that and now I get Run-time error '429': ActiveX component can't create object
 
Upvote 0
What happens when you replace
Code:
Set objpowerpoint = New PowerPoint.Application
with

Code:
Dim objpowerpoint As Object

Set objpowerpoint = pptApp.Presentations.Add


This doesn't create a specific cast to powerpoint and therefor doesn't need that specific ActiveX component
 
Upvote 0
Thanks for your help! It is for me completely puzzling - I just tried your suggestion and now instead I get [h=2]Run-time error '424': Object required[/h]
 
Upvote 0
Thanks for your help! It is for me completely puzzling - I just tried your suggestion and now instead I get Run-time error '424': Object required

Hi jenwer, I have the same problem with 2013 Excel, it seems that in Powerpoint does not recognize the chart or graphic. Did you already solve it?

Thanks
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top