![]() |
|
||||||||
| Site Links |
| Consulting |
| Knowledge Base |
| Training |
| Forum |
| Articles |
| Resources |
| Products |
| Cool Tools |
| Contact |
| About Us |
| Go to Page... |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
|
Saving Clipboard data as picture
ITT, How would you reference the clipboard's data when it is a picture (ie: you have copied a picture to the clipboard), and save it to a file?
I have looked high and low for an answer and have yet to find one. I know you can do this in vb6 (that is the answer I keep finding) and I know you can do this for text, but there must be some way of doing this? Any help would be much appreciated. -Once my PC stopped working, so I kicked it......Then it started working again
|
|
Local Time: 11:38 PM
Local Date: 05-18-2013 Location:
|
|
|
|
#2 |
|
|
If the picture is a bitmap, you can access the clipboard as type CF_DIB which VBA can handle by calling a .wsc file. Other image formats are a bit more complicated.
Could you post more specifics about what you are trying to accomplish? Stan |
|
Local Time: 07:38 PM
Local Date: 05-18-2013 Location:
|
|
|
|
#3 |
|
|
Ideally I would want to do it in Access, but it is fine if it is in another office app.
I want to create a macro that will save the contents of the clipboard (if a picture, especially if someone has pressed "printscreen") to a jpg, bmp or png file to a location on their computer. I would prefer a straight save to the location rather than pasting it to word or paint and saving it (i did see one sort of solution using sendkeys and timing events, but that wouldn't be suitable). Thanks for your reply. Hope what I am looking for is clearer to you. -Once my PC stopped working, so I kicked it......Then it started working again
|
|
Local Time: 11:38 PM
Local Date: 05-18-2013 Location:
|
|
|
|
#4 |
|
Moderator
|
I found this at this location. I have not tested and don't have access to test it with.
http://groups.google.ca/group/microsoft.public.access.modulesdaovba/browse_thread/thread/674742b64c6e7d01/3e95e8f696986245?lnk=st&q=getclipboarddata(cf_bitmap)+visual+basic&rnum=2&s afe=on VBA:
VBA tags courtesy of www.thecodenet.com
|
|
Local Time: 05:38 PM
Local Date: 05-18-2013 Location:
|
|
|
|
#5 |
|
|
Doesn't quite work, seems to want to copy an ole object all the time.
Plus it fills up the clipboard, so copy and paste no longer work "out of memory". Thanks for the effort though, is almost there ![]() -Once my PC stopped working, so I kicked it......Then it started working again
|
|
Local Time: 11:38 PM
Local Date: 05-18-2013 Location:
|
|
|
|
#6 |
|
|
The original coding in this file was from Stephen Bullen. He used a form with a picture object on it. The picture object was filled with the data on the clipboard. Anyway, I've written a routine that uses his functions to deal with a picture on the clipboard. The routine will allow you to select the destination where you want to save your picture (bmp file) and you may choose your name. If no picturedata is present, you will be informed.
Just press printscreen, select the workbook with this routine and run the routine save_a_picture. Hope you'll like this one. Charlize |
|
Local Time: 12:38 AM
Local Date: 05-19-2013 Location:
|
|
|
|
#7 |
|
|
That is perfect Charlize. Thank you very much.
(sorry for the late reply, been too busy with other projects to test it ![]() -Once my PC stopped working, so I kicked it......Then it started working again
|
|
Local Time: 11:38 PM
Local Date: 05-18-2013 Location:
|
|
|
|
#8 |
|
|
You're a rock star, mate. That's just what I needed. Thanks for posting that!
|
|
Local Time: 06:38 PM
Local Date: 05-18-2013 |
|
|
|
#9 |
|
|
thank you workin fine
|
|
Local Time: 06:38 PM
Local Date: 05-18-2013 |
|
|
|
#10 | |||||||||||||||||||||||
|
|
New to this board so I may have not replied correctly. Please email me a copy of your modified code bit as I'm trying to do the same thing or if there is a way to do this in Excel 2010, let me know. Thanks, |
|||||||||||||||||||||||
|
Local Time: 06:38 PM
Local Date: 05-18-2013 Location:
|
|
|
|
#11 | |||||||||||||||||||||||
|
|
Just download the zip from a few posts above. Tried it in excel 2010 and works as described (at least for me). Charlize |
|||||||||||||||||||||||
|
Local Time: 12:38 AM
Local Date: 05-19-2013 Location:
|
|
|
|
#12 |
|
|
Thanks for the reply, I was trying to get this to run in Excel 2010 64BIT.
|
|
Local Time: 06:38 PM
Local Date: 05-18-2013 Location:
|
|
|
|
#13 | |||||||||||||||||||||||
|
|
Looking for the zip file that you are referencing. If you can repost it I would be very appreciative. Thank you. |
|||||||||||||||||||||||
|
Local Time: 06:38 PM
Local Date: 05-18-2013 Location:
|
|
|
|
#14 |
|
|
As requested the zip with excel file.
Charlize |
|
Local Time: 12:38 AM
Local Date: 05-19-2013 Location:
|
|
|
|
#15 |
|
|
Stephen's code will not work in 64bit Office as it is. I do not have 64bit installed to test, but I believe it should convert as follows:
VBA:
VBA tags courtesy of www.thecodenet.com
Be as you wish to seem |
|
Local Time: 02:38 AM
Local Date: 05-19-2013 |
|
|
|
#16 |
|
|
Out Of Memory Error
Hello, i tried the above code but i still received the "Out Of Memory" Error
|
|
Local Time: 06:38 PM
Local Date: 05-18-2013 Location:
|
|
|
|
#17 |
|
|
MS Access
I'm Sorry I tried the Code in MS Access, now i see that your Attached Code is for Excel,
Do you have a code that can be used in access, the other i tried and i'm getting the "Out Of memory" Error |
|
Local Time: 06:38 PM
Local Date: 05-18-2013 Location:
|
|
|
|
#18 |
|
|
Hi yoelyfie,
after experimenting with the code and running into errors, I kept receiving "Out of Memory" messages on normal Copy&Paste actions in the editor. It helped to call CloseClipboard to properly close the Clipboard. |
|
Local Time: 12:38 AM
Local Date: 05-19-2013 Location:
|
|
|
|
#19 |
|
|
Many thanks, it's what I was looking for.
|
|
Local Time: 01:38 AM
Local Date: 05-19-2013 Location:
|
|
|
|
#20 |
|
|
Thanks !
|
|
Local Time: 03:38 PM
Local Date: 05-18-2013 Location:
|
|
![]() |
| Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|


