Consulting

Results 1 to 5 of 5

Thread: printscreen saved as a file

  1. #1
    VBAX Mentor OTWarrior's Avatar
    Joined
    Aug 2007
    Location
    England
    Posts
    389
    Location

    printscreen saved as a file

    Is there of referencing the printscreen as an image object and saving it to a location?

    To put it simply:

    1) press printscreen

    2) on Access form press a commandbutton

    3) vba code saves contents of clipboard as image file to a location.

    Is such a thing possible?
    -Once my PC stopped working, so I kicked it......Then it started working again

  2. #2
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    While the link below will not directly answer your question it will give a general idea of how to use an ADODB.Stream with image objects. Once you can move a clipboard object to a Stream, saving it to a file or a DB field is trivial. Stan



    http://visualbasic.ittoolbox.com/gro...irectly-134154

  3. #3
    VBAX Mentor OTWarrior's Avatar
    Joined
    Aug 2007
    Location
    England
    Posts
    389
    Location
    That code looks interesting, but the problem I am having is trying to find a way of getting the data from the clipboard, which I don't see any reference to on that page. Thanks for the link anyway though

    I did find this code:
    [VBA]SavePicture Clipboard.GetData, "c:\temp\MyCopiedPicture.bmp"[/VBA]

    But Access doesn't like clipboard.getdata, "variable not defined."

    Any ideas on what reference file I need to load?
    -Once my PC stopped working, so I kicked it......Then it started working again

  4. #4
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    I think you have to link in GDI to get that functionality. There is a workaround, a bit clumsy but.

    1. Save image to clipboard
    2. Open up Excel, paste image into graph
    3. Export Graph to a file

    when I did this I would always set the visible property of Excel to False so the screen didn't get too busy. I am sure someone else on this board can direct you to specific code to accomplish this. Stan

  5. #5
    VBAX Mentor OTWarrior's Avatar
    Joined
    Aug 2007
    Location
    England
    Posts
    389
    Location
    I have found some code at the following site:
    http://www.la-solutions.co.uk/conten...-Clipboard.htm

    But have yet to get it to work. Keeps saying error type mismatch, cannot open the file '0'.

    Any help?
    -Once my PC stopped working, so I kicked it......Then it started working again

Posting Permissions

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