使用excel-VBA操作Paint女士 [英] Operating Ms Paint using excel-VBA

查看:109
本文介绍了使用excel-VBA操作Paint女士的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了代码,将图表从工作表(在我的excel工作簿中)复制到Ms-Paint,然后保存结果.

I've written a code to copy the charts from a worksheet (in my excel workbook) to Ms-Paint and then saving the results.

Sub paintCharts()
ThisWorkbook.Sheets("DesiredData").Activate
With ActiveSheet.ChartObjects.ShapeRange.Group
    .CopyPicture
    .Ungroup
End With
Dim path_Paint As String
Dim paintID As Variant
path_Paint = "C:\Windows\System32\mspaint.exe"
paintID = Shell(path_Paint, vbNormalFocus)
Call AppActivate(paintID)
Call SendKeys("^V")
End Sub

我在Call AppActivate(paintID)处遇到一个错误,我想问一下是否通过调用Call SendKeys("^V")然后Call SendKeys("^S")来完成这项工作.

I am getting an error at the Call AppActivate(paintID) further, I want to ask if by calling Call SendKeys("^V") and then Call SendKeys("^S") will do the job.

推荐答案

是否需要通过油漆保存?您可以直接保存图表本身.

Does it need to be saved by paint? You can save charts themselves directly.

只需使用

Set objChart = ActiveChart 
objChart.Export ("filename.jpg")

尽管查看了日期,但我认为您现在已经知道了...

Though looking at the date, I assume you figured it out by now...

这篇关于使用excel-VBA操作Paint女士的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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