PDA

View Full Version : Solved: Send keys to print screen



talytech
02-20-2009, 01:20 PM
I'm trying to copy the active form window to the cliboard so that I can paste it into another application. Doing it manually works just fine (ctrl + alt+ print screen). How do I use the "send keys method" to send to those keys? I've tried everything and I know its probably simple but I can't seem to get it to work. Here's what I have:


SendKeys "{^}{%}{PrtSc}"

CreganTur
02-20-2009, 01:31 PM
Honestly, I would caution you from using SendKeys for a number of different reasons. Mainly because they can be intercepted- the SendKeys will go to whatever window has focus, which could be a security risk, depending on what you're working on.

I suggest looking at this article (http://word.mvps.org/FAQS/MacrosVBA/PrtSc.htm) that shows how to use API calls to capture a screen at the end of the article.

If you have to use SendKeys, then use:

Sub PrintTheScreen()
Application.SendKeys "(%{1068})"
End Sub

talytech
02-20-2009, 02:14 PM
I tired your code and it returned the following error. "Compile ERror: Method or Data member not found"

I don't know if I told you that I'm trying to copy an active form in MS Access. Is that the problem?

talytech
02-20-2009, 02:21 PM
Thanx alot for that information. I used the API code and it worked like a charm. thanks again.