【问题标题】:How do I get Excel VBA PasteSpecial a chart into PowerPoint without links?如何在没有链接的情况下将 Excel VBA PasteSpecial 图表导入 PowerPoint?
【发布时间】:2019-06-10 11:20:07
【问题描述】:

我正在编写一个实用程序来将图表和表格从 Excel 复制到 Powerpoint 演示文稿中。 要求之一是能够以 3 种方式之一粘贴。其中2个很简单。这个我有问题: 作为可编辑的图表,但链接已停用,因此用户可以在 Powerpoint 中格式化图表,但对 Excel 中原始图表数据的更改将无法通过。

我该怎么做?

我已经尝试了几乎所有我能想到的数据类型和链接选项,例如

activeSlide.Shapes.PasteSpecial DataType:=ppPasteShape, Link:=msoFalse
activeSlide.Shapes.Paste
ppApp.CommandBars.ExecuteMso "PasteSourceFormatting"
activeSlide.Shapes.PasteSpecial DataType:=ppPasteDefault, Link:=msoFalse
activeSlide.Shapes.PasteSpecial DataType:=ppPasteOLEObject, Link:=msoFalse 

PasteOLEOBject 使 Excel 崩溃,即使前面有 5000 个 DoEvent 循环

但它要么粘贴为无法在 PowerPoint 中编辑的图表,要么粘贴为可以编辑但仍链接到源数据的图表,因此它会相应地更改 Powerpoint。

【问题讨论】:

    标签: excel vba charts powerpoint


    【解决方案1】:

    取消请求。 我发现粘贴后您可以断开形状的链接:-

    activeSlide.Shapes.Paste
    ppApp.CommandBars.ExecuteMso "PasteSourceFormatting"
    For intCount = 1 To 5000: DoEvents: Next
    activeSlide.Shapes(activeSlide.Shapes.Count).LinkFormat.BreakLink
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-26
      • 2012-11-08
      • 1970-01-01
      • 2016-10-30
      • 1970-01-01
      • 2011-09-15
      • 2017-06-18
      • 2021-11-20
      相关资源
      最近更新 更多