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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ali55555551
    New Member
    • Dec 2014
    • 2

    #1

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

    Code:
    Public Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Int32) As UShort
    
    Sub ScreenOnkey(ByRef Target As Range)
    Dim index As Integer
    index = 0
    mb = InputBox("You name please")
    
    While index <= mb
    
        If (GetAsyncKeyState(VK_SNAPSHOT)) Then
    
            Sleep 250
    
            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
    
            index = index + 1
        End If
            ActivePresentation.Slides.Add 1, ppLayoutBlank
            ActivePresentation.Slides(1).Shapes.Paste
    Wend
    
    
    End Sub
    Now problem is when i run my macro it is not concluding the ScreenOnkey. Thanks
  • Ali55555551
    New Member
    • Dec 2014
    • 2

    #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.

    Comment

    Working...