How to take a screenshot

dmr

Registered User.
Local time
Today, 08:54
Joined
Dec 15, 2009
Messages
34
Is there a way to take a screenshot with vba? (Ideally of just the active form). I want to send it as an email attachment.
 
I have been curious about your quest so I have been searching around but cannot find a VBA method to create a file from an image stored in the clipboard. Please post back if you are successfull.

This was the simplest I found to get the active window into the clipboard....

Code:
[URL="http://word.mvps.org/FAQS/MacrosVBA/PrtSc.htm"]http://word.mvps.org/FAQS/MacrosVBA/PrtSc.htm[/URL]
'To capture the screen

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 VK_SNAPSHOT = &H2C

Sub PrintScreen()
    keybd_event VK_SNAPSHOT, 1, 0, 0
End Sub
 
Can you explain why you are using a Big Brother tactic to capture a screen shot of what your user's are doing? I found a working VBA solution but I wanted to inquire before posting it.
 

Users who are viewing this thread

Back
Top Bottom