excel vba在ms画中粘贴截图

时间:2016-06-06 20:35:17

标签: excel-vba vba excel

您好我有一个vba代码,它会在网站上截取屏幕截图,我想将其粘贴到MS PAINT中,然后再次复制粘贴到MS ACCESS数据库中。现在我试图将屏幕截图粘贴在MS PAINT上,但它无效。

这是我的代码部分,我将做截图然后打开mspaint粘贴:

keybd_event VK_MENU, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0

'open mspaint
Shell "C:\windows\system32\mspaint.exe", 1

Application.SendKeys "^V"

1 个答案:

答案 0 :(得分:0)

再挖一点,这应该有用

'your code to get the screenshot
Dim WshShell as Object
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "mspaint"
 Application.Wait Now + TimeValue("00:00:01")

WshShell.AppActivate "Paint"
Application.Wait Now + TimeValue("00:00:01")

WshShell.SendKeys "^(v)"
 Application.Wait Now + TimeValue("00:00:01")