使用Excel宏复制瀑布图时出错 [英] Error copying waterfall charts with Excel macro

查看:78
本文介绍了使用Excel宏复制瀑布图时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些简单的VBA代码,这些代码在Excel工作簿中的一系列图形之间循环,并将它们复制到PowerPoint演示文稿中。它适用于除瀑布图形之外的所有图形(错误445:对象不支持此选项)。由于它们在Excel中相对较新,因此我认为可能存在兼容性问题,并且想知道是否有解决方法。

I have some simple VBA code that loops through a range of graphs in my Excel workbook and copies them to a PowerPoint presentation. It works great for all graphs except for waterfall graphics (Error 445: "Object doesn't support this option"). Since they're relatively new to Excel, I thought there might be an issue of compatibility and was wondering if there was a workaround.

谢谢!

'Bar chart ==> works fine
ActiveWorkbook.Sheets(7).ChartObjects("Graphique 1").Copy
' Waterfall chart ==> Error 445
ActiveWorkbook.Sheets(8).ChartObjects("Graphique 1").Copy

编辑:当我尝试使用Excel的宏记录器记录该过程时,它给了我相同的代码行,但是当执行代码时,我遇到了相同的错误。

When I try to record the procedure with Excel's macro recorder, it gives me the same lines of code, but when executing the code, I get the same error.

ActiveSheet.ChartObjects("Graphique 1").Activate
Selection.Copy


推荐答案

我已经对瀑布图进行了测试,似乎VBA无法复制这种类型的图。

I've tested with the waterfall chart and it does seem like VBA is not able to copy that type of chart.

可能的解决方法:
您可以使用 .copyPicure 复制为图片通过使用以下解决方法:

Potential fixes: You're able to copy as a picture using .copyPicure or you can make a workaround by using:

YourchartObject.duplicate.select
selection.cut

然后粘贴到Powerpoint。

and then pasting to the Powerpoint.

这篇关于使用Excel宏复制瀑布图时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆