vba 如何使用pastepecial将图表作为位图粘贴到vba中的另一个工作表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14801459/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use pastepecial to paste a chart as bitmap to another sheet in vba
提问by JumboFive
Is there a way to use the pastspecial method to paste a copyied chart as a bitmap to another worksheet. Currently this is my syntax-
有没有办法使用过去的特殊方法将复制的图表作为位图粘贴到另一个工作表。目前这是我的语法-
PasteSheet.PasteSpecial (Format:="Bitmap", Link:=False, DisplayAsIcon:=False)
Where PasteSheet is the other worksheet i want to paste to. Currently with this code, it is only pasting in the active sheet. Do i have to use select to copy then select the page i want to paste to, then change back to the sheet I copied from? I hope not as I have a lot of sheets haha.
PasteSheet 是我要粘贴到的另一个工作表。目前使用此代码,它仅粘贴在活动工作表中。我是否必须使用选择复制然后选择我想要粘贴到的页面,然后改回我从中复制的工作表?我希望不是因为我有很多床单哈哈。
Thank you
谢谢
Edit: I have found out that if I Copy the chart as a shape rather than a chartobject I can use the pasteSpecial method to paste to another sheet. That being said it now pastes charts into one another creating one mega chart haha.
编辑:我发现如果我将图表复制为形状而不是图表对象,我可以使用 pasteSpecial 方法粘贴到另一张纸上。话虽如此,它现在将图表粘贴到另一个创建一个巨型图表哈哈。
GraphSheet.Shapes(chtName).Copy
PasteSheet.PasteSpecial Format:="Microsoft Office Drawing Object", Link:=False , _
DisplayAsIcon:=False
回答by Tim Williams
This will work without needing to activate/select Sheet2:
这将无需激活/选择 Sheet2 即可工作:
Sheet1.ChartObjects(1).Chart.CopyPicture
Sheet2.Paste
回答by Floris
Do i have to use select to copy then select the page i want to paste to, then change back to the sheet I copied from?
我是否必须使用选择复制然后选择我想要粘贴到的页面,然后改回我从中复制的工作表?
Yes- the sheet you paste into must be active. Use Sheets("mytargetname").Select
- just using Activate
isn't enough...
是- 您粘贴到的工作表必须处于活动状态。使用Sheets("mytargetname").Select
- 仅仅使用Activate
是不够的......
If you set
如果你设置
Application.ScreenUpdating = False
your screen won't flash while you do this...
执行此操作时,您的屏幕不会闪烁...