Print screen using VBA in SAP

If you are using SendKeys then avoid using it. I had used it in the past project and it seems to be inconsistent and error-prone.

You can use the below snippet at the top of the module and call it wherever required.

Option Explicit
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal _bScan As Byte,
 ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Const VK_SNAPSHOT = &H2C
Private Const VK_MENU = &H12
Sub PrintScreen()
    keybd_event VK_SNAPSHOT, 1, 0, 0
 End Sub
Swarali Sree
Swarali Sree

I love thought experiments.