Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create screenshot via vba code

Status
Not open for further replies.

macl

Programmer
Sep 15, 2004
65
DE
Hi all, does somebody know how i can create a screenshot via vba code?
by clicking a button a screenshot shall be made and then this picture (bmp) shall be automatically stored in a ole object field of the access database
does anybody know how to do that?
thanks so much
 
don't think there's a native function to do this, so you'd either have to use sendkeys, ctrl+prntScrn puts screenshot into clipboard, or use an api call to get the screenshot...

--------------------
Procrastinate Now!
 
Most advice you find here, is to not store such in Access...

This should take a screenshot and place it in the clipboard

[tt]' in the declaration section of a module
private declare sub keybd_event Lib "user32.dll" _
(byval bVk as Byte, byval bScan as Byte, _
byval dwFlags as Long, byval dwExtraInfo as Long)

private const VK_SNAPSHOT = &H2C

' then in a relevant event, call it like this (two versions)

keybd_event VK_SNAPSHOT, 1, 0, 0 ' ALT+PRINTSCR
'keybd_event VK_SNAPSHOT, 0, 0, 0 ' PRINTSCR[/tt]

- paste it where you like it

Roy-Vidar
 
hi thanks for the help :)
i still have a problem though once i run this code and the pic is in the clipboard, how can i get it out of there again?
like opening it so the user can make changes to it then put it back to the clipboard?
do you know if i can have more then one pic stored there? so that i can later put them into the database at once?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top