By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,041 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

I am working on vba PowerPoint. I am new in vba so kindly bear me. I'm trying to capt

P: 2
Expand|Select|Wrap|Line Numbers
  1. Public Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Int32) As UShort
  2.  
  3. Sub ScreenOnkey(ByRef Target As Range)
  4. Dim index As Integer
  5. index = 0
  6. mb = InputBox("You name please")
  7.  
  8. While index <= mb
  9.  
  10.     If (GetAsyncKeyState(VK_SNAPSHOT)) Then
  11.  
  12.         Sleep 250
  13.  
  14.         keybd_event VK_MENU, 0, 0, 0
  15.         keybd_event VK_SNAPSHOT, 0, 0, 0
  16.         keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0
  17.         keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
  18.  
  19.         index = index + 1
  20.     End If
  21.         ActivePresentation.Slides.Add 1, ppLayoutBlank
  22.         ActivePresentation.Slides(1).Shapes.Paste
  23. Wend
  24.  
  25.  
  26. End Sub
  27.  
Now problem is when i run my macro it is not concluding the ScreenOnkey. Thanks
Dec 24 '14 #1
Share this Question
Share on Google+
1 Reply


P: 2
I am working on vba PowerPoint. I am new in vba so kindly bear me. I'm trying to capture the active screen using GetAsynKeyState function. And paste it to PowerPoint .Following is the code in which it should work when i press key VK_MENU.
Dec 24 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.