Resizing and re-position image pasted to PowerPoint from Excel (VBA)

bergsorensen

New Member
Joined
Jul 4, 2014
Messages
26
I got a small snippet of code that, from a list, copy's a chart and paste it as a metapicture to powerpoint - 1 chart/picture on its own slide.

My issue is, im not able to generate a code that resizes/re-position (center align) the pasted picture.

Would anyone be able to give me a pointer of how?

Heres the cope-snippet:

For x = LBound(arrGraphs) To UBound(arrGraphs)
Graphtobeprinted = arrGraphs(x)
fromsheet= arrSheets(x)

'Create new powerpoint dias (12=empty)
Set pptSld = pptPres.Slides.Add(x, 12)

'Copy chart
Sheets(fromsheet).Select
ActiveSheet.ChartObjects(Graphtobeprinted).Activate
ActiveChart.ChartArea.Copy


'Paste chart
pptSld.Application.Activate
pptSld.Shapes.PasteSpecial DataType:=ppPasteEnhancedMetafile

'Resize and center/align
'???

Next

Thank you!!
Best

Kasper
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
small modification (paste as a shape):

For x = LBound(arrGraphs) To UBound(arrGraphs)
Graphtobeprinted = arrGraphs(x)
fromsheet = arrSheets(x)

'Create new powerpoint dias (12=empty)
Set pptSld = pptPres.Slides.Add(x, 12)

'Copy chart
Sheets(fromsheet).Select 'needs to be made part of the array and refeered to as a variable
ActiveSheet.ChartObjects(Graphtobeprinted).Activate
ActiveChart.ChartArea.Copy


'Paste chart
'pptSld.Application.Activate
Set pptShape = pptSld.Shapes.PasteSpecial(DataType:=ppPasteOLEObject, Link:=msoFalse)(1)

'Resize and center/align
'???

Next
 
Upvote 0

Forum statistics

Threads
1,216,105
Messages
6,128,860
Members
449,472
Latest member
ebc9

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