【发布时间】:2020-11-20 09:06:31
【问题描述】:
我的代码在 Windows 上运行良好,但在 MacBook 上却不行。我需要将一系列单元格复制到 Powerpoint,但它应该是可编辑的,所以我只需要复制文本。 PasteSpecial 似乎不适用于 Mac 办公室。在 Mac 中起作用的是将单元格范围复制为图片并将其作为图像粘贴到 powerpoint。这不应该是这种情况,因为粘贴的形状应该是可编辑的。我下面的代码请帮忙。
{
Opening PPT and creating a new presentation
Set ppApp = New PowerPoint.Application
Set ppPres = ppApp.Presentations.Add
'Add and select new slide
Set ppSlide = ppPres.Slides.Add(1, ppLayoutBlank)
ppSlide.Select
'Copy range from excel sheet
Sheets("ToPPT").Range("rng_Picture").Copy
DoEvents
'Paste range as html
Set shp = ppSlide.Shapes.PasteSpecial(DataType:=ppPasteHTML)
With ppPres.PageSetup
shp.Width = .SlideWidth
shp.Height = .SlideHeight
End With
'adjust position in slide
ppApp.ActiveWindow.Selection.ShapeRange.Align msoAlignTops, msoTrue
ppApp.ActiveWindow.Selection.ShapeRange.Align msoAlignLefts, msoTrue
}
【问题讨论】:
标签: excel vba macos powerpoint