Consulting

Results 1 to 3 of 3

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

  1. #1

    Smile Taking Printscreen-opened application(PuTTY or cmd) using VBA and pasting it in word

    Hi,

    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 ..
    Regards,
    Karthik

  2. #2

    Thumbs up

    Please anyone help me out in this....

  3. #3
    VBAX Expert Tinbendr's Avatar
    Joined
    Jun 2005
    Location
    North Central Mississippi (The Pines)
    Posts
    993
    Location
    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.
    [VBA]Sub AddScrnPrint()
    Dim aDoc As Document
    Set aDoc = Documents.Add
    aDoc.Range.Paste
    End Sub
    [/VBA]

    David


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •