Try this one. You can just pass to the function the path where you want the captured image to be saved.
Code:
Public Declare Sub keybd_event Lib "user32" ( _
ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
Public Sub Capture_Desktop(ByVal strDestination As String)
On Error Resume Next
DoEvents
'To get the Entire Screen:
'Call keybd_event(vbKeySnapshot, 0, 0, 0)
'To get the Active Window:
'Call keybd_event(vbKeySnapshot, 1, 0, 0)
Call keybd_event(vbKeySnapshot, 0, 0, 0) 'Get the screen and copy it to clipboard
DoEvents 'let computer catch up
SavePicture Clipboard.GetData(vbCFBitmap), strDestination ' saves the clipboard data to a BMP file
End Sub