468,140 Members | 1,165 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,140 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

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
1 987
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.

Similar topics

2 posts views Thread by Adam T. Gautier | last post: by
2 posts views Thread by ianLOSEatTHEaltispartnersCAPS.com | last post: by
9 posts views Thread by MattC | last post: by
6 posts views Thread by BWPanda | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.