小编Ali*_*lik的帖子

在vba powerpoint中按键时调用Sub

此代码捕获活动窗口并将其粘贴到功率点幻灯片上,方法是通过调用a来粘贴数字屏幕截图sub PrintScreen,之后需要5秒钟来捕获活动窗口的屏幕.虽然我希望每当我按下像'F7或F3等'的特定键时,它应该采用打印屏幕而不是等待5秒钟.我只想按下键并调用sub,其中我指定了打印和粘贴以及其他功能.

Sub Screen_Capture_VBA()
 Dim Sec4 As Date
 MsgBox "Note: Three seconds after you click OK " & _
 "the active window will be copied to the clipboard."
 Sec4 = DateAdd("s", 4, Now)
 myValue = InputBox("Give me no of screen shots you want to capture")
 For I = 1 To myValue
 PrintScreen
 Next I
End Sub
Run Code Online (Sandbox Code Playgroud)

这是我的打印屏幕子.

Sub PrintScreen()

Sleep 5000
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, …
Run Code Online (Sandbox Code Playgroud)

vba keyboard-shortcuts powerpoint-vba

2
推荐指数
1
解决办法
7886
查看次数

标签 统计

keyboard-shortcuts ×1

powerpoint-vba ×1

vba ×1