简体   繁体   中英

Pasting images (excel Table) in PowerPoint

I'm trying to paste excel table as picture into PPT though VBA but the images are not in the desired shape as codded

The Require coordinates are:

Height 14.80
Width 23.28
Top 2.13
Left 5.3

and the output coordinates are like:

H-18.73 CM
W-23.28 CM
Horizontal-5.3 CM
Vertical-2.13

below is my code:

Range(cel.Value).Copy
newPowerPoint.ActiveWindow.View.GotoSlide cel.Offset(0, -1).Value
Set activeSlide = newPowerPoint.ActivePresentation.Slides(cel.Offset(0, -1).Value)
activeSlide.Shapes.PasteSpecial(DataType:=ppPasteEnhancedMetafile).Select
newPowerPoint.ActiveWindow.Selection.ShapeRange.Height = Application.CentimetersToPoints(14.80)
newPowerPoint.ActiveWindow.Selection.ShapeRange.Width = Application.CentimetersToPoints(23.28)
newPowerPoint.ActiveWindow.Selection.ShapeRange.Left = Application.CentimetersToPoints(2.13)
newPowerPoint.ActiveWindow.Selection.ShapeRange.Top = Application.CentimetersToPoints(5.3) 

Good workaround is to place a shape where you want it and use Debug.print to read the position in points.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM