简体   繁体   English

在 PowerPoint 中粘贴图像(excel 表格)

[英]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我正在尝试通过 VBA 将 excel 表格作为图片粘贴到 PPT 中,但图像不是编码所需的形状

The Require coordinates are:要求坐标是:

Height 14.80
Width 23.28
Top 2.13
Left 5.3

and the output coordinates are like: output 坐标如下:

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.好的解决方法是将形状放置在您想要的位置并使用 Debug.print 以点为单位读取 position。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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