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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to paste a screenshot of data page to email through code

Status
Not open for further replies.

daddypost

Technical User
Oct 21, 2004
98
US
I've got a data page in access that I need to take a screenshot of and email(the reason being if I email just the data page, when you open it, it contains only the template and no data). I'm able to get it to the clipboard using VBA:
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

keybd_event VK_SNAPSHOT, 1, 0, 0 ' ALT+PRINTSCR

But I not I can't figure out how to get this off of clipboard or how to simulate control+V. I can manually open an email, go to the subject and paste it in, but I can't do it through code. Any help would be greatly appreciated. Or if anyone has another way of getting a data page to someone where they can actually view the data, that would work too.

Thank you.
 
Try to interact with the clipboard directly after taking the screenshot, this site gives some good ideas:


I would take the screenshot, print the clipboard to a PDF driver, then add the pdf file to the message as an attachment using...

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = strto
.Subject = strsub
.Body = strbody
.FlagIcon = 1
.Importance = 2
.Attachments.Add "C:\PDFS\YourPDFfile.PDF" .Send
End With
Set objEmail = Nothing
 
At least I'm thinking on the right lines. The problem is I can't get the bitmap off the clipboard to save as .pdf file. I went to the site you referenced and got this :
$image = Win32::Clipboard::GetBitmap();
open BITMAP, ">some.bmp";
binmode BITMAP;
print BITMAP $image;
close BITMAP;
but to be honest with you, that is pretty foreign to me. I copied it over to my module, but of course it isn't complete. I don't know how to make this work. Do you have any ideas. Thank you for your response by the way.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top