将Powerpoint形状范围variables设置为VBA中的Pastespecial方法
我正在使用这段代码将数据从Excel粘贴到Powerpoint中。
PPSlide.Shapes.PasteSpecial DataType:=ppPasteMetafilePicture 'Where PPSlide is a `PowerPoint.Slide` object that was previously set 'For your info, I am using late binding.
问题是由于某些原因,在上面的PasteSpecial
行之后,Excelmacros的某些用户在Excel代码尝试引用应该从此代码返回的结果ShapeRange对象时出现错误。 错误出现在这样的行上:
PPApp.ActiveWindow.Selection.ShapeRange.Height = dHeight 'Where PPApp is a PowerPoint.Application object using late binding
当我回头看PowerPoint幻灯片,我可以看到被粘贴的Shape
对象没有被选中。 它只发生在一些用户。 在我的机器上,按照PasteSpecial
select形状对象。 我想也许我可以定义一个ShapeRange
对象,而执行PasteSpecial
像这样:
Set PPShapeRange = PPSlide.Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture)
但是这不起作用。 我在这行上得到一个错误。 有任何想法吗?