View Full Version : Taking Printscreen-opened application(PuTTY or cmd) using VBA and pasting it in word

02-25-2011, 10:00 PM

I want to automate the following task. I have tried this with vbscript and i have learnt that it was not possible with vbscript. Before I begin, I want to confirm whether the follwing can be done using VBA:
1. Open PuTTY or cmd application
2. Take screenshot of the PuTTY or cmd in a single press(Preferrable PRINTSCREEN button)
3. Open a word document and paste the clipboard content(screenshot)

I will be working in PuTTY or cmd window and my focus will be in that window only. So whenever I want to take the screenshot of the PuTTY screen, on a single press of the key, the screenshot image should automatically get pasted in the word document.
Is it possible using VBA? Please help me out...

Please Note: I cannot go for any higher level languages as it is not allowed at my work..

I have tried using VBScript and I achieved not completely. I did in VBScript to automatically taking screenshots of the PuTTY screen which I am working at a interval say 3 seconds and paste it into word document. But I want to take screenshot only when I wish i.e., on a press of a key(Preferrably PRINTSCREEN key).. As VBScript cannot detect or handle the events when its focus is lost.. Is it possible in VBA to detect the events of a opened application ?

Any other suggestions are welcomed.. Thank You ..

02-26-2011, 12:40 AM
Please anyone help me out in this.... :help

02-26-2011, 06:59 AM
This is how I do it.

I use the Alt-PrtScn buttons to capture the screen. Then I added this to Normal-ThisDocument. You want it in Normal so that the code won't be lost if you don't save the document.
Sub AddScrnPrint()
Dim aDoc As Document
Set aDoc = Documents.Add
End Sub