View Full Version : printscreen saved as a file
OTWarrior
02-16-2009, 03:50 AM
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?
stanl
02-16-2009, 04:32 AM
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/groups/technical-functional/visualbasic-l/save-image-from-db-to-picture-box-directly-134154
OTWarrior
02-16-2009, 04:43 AM
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:
SavePicture Clipboard.GetData, "c:\temp\MyCopiedPicture.bmp"
But Access doesn't like clipboard.getdata, "variable not defined."
Any ideas on what reference file I need to load?
stanl
02-16-2009, 04:57 AM
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
OTWarrior
02-17-2009, 04:31 AM
I have found some code at the following site:
http://www.la-solutions.co.uk/content/MVBA/MVBA-Clipboard.htm
But have yet to get it to work. Keeps saying error type mismatch, cannot open the file '0'.
Any help?
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.