Ali*_*lik 2 vba keyboard-shortcuts powerpoint-vba
此代码捕获活动窗口并将其粘贴到功率点幻灯片上,方法是通过调用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, 0, KEYEVENTF_KEYUP, 0
ActivePresentation.Slides.Add 1, ppLayoutBlank
ActivePresentation.Slides(1).Shapes.Paste
End Sub
Run Code Online (Sandbox Code Playgroud)
PowerPoint不支持为Excel中的宏指定键盘快捷键.您可以购买第三方应用程序,如OfficeOne Shortcut Manager,但更简单的解决方法是将宏添加到快速访问工具栏.
More CommandsChoose commands from选择宏Add >>按钮OK
然后你可以使用alt+ 1(或QAT指定的任何数字)来执行PrintScreen().按alt一次键,查看PowerPoint分配给宏的快捷方式号码.
