+ Reply to Thread
Results 1 to 8 of 8

screenshot and paste to email VBA

  1. #1
    Valued Forum Contributor
    Join Date
    10-17-2007
    Location
    Tasmania, Australia
    MS-Off Ver
    2019, 365(v2310)
    Posts
    366

    screenshot and paste to email VBA

    Hi Guys and Gals,

    Just wondering, the below screenshots and pastes in an email quite nicely. However, I was wondering how to make only screenshot the active excel screen, rather then the entire dual screen setup.

    Is it to hard to attach it as an attachment rather then a copy and paste.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: screenshot and paste to email VBA

    Put the code below in a standard code module.

    Replace...
    Application.SendKeys "(%{1068})"

    With...
    AltPrintScreen

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 06-27-2017 at 11:44 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Valued Forum Contributor
    Join Date
    10-17-2007
    Location
    Tasmania, Australia
    MS-Off Ver
    2019, 365(v2310)
    Posts
    366

    Re: screenshot and paste to email VBA

    Still takes the SS of both monitors and not the active workbook or primary screen.

    Sorry I am new to VBA and I am just a google king really.

    Module 4
    Please Login or Register  to view this content.
    Module 5
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: screenshot and paste to email VBA

    did you find this on google to try ?
    https://www.mrexcel.com/forum/excel-...ot-thanks.html
    you need to determine primary/secondary screen and then know the screen size to set

    Re:
    Is it to hard to attach it as an attachment rather then a copy and paste.
    if you want as attachment i would suggest a seperate method to create the attachment(i assume you want jpg or pdf?)

    then the email code would be much easier, whereby it simple email + attachment code
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  5. #5
    Valued Forum Contributor
    Join Date
    10-17-2007
    Location
    Tasmania, Australia
    MS-Off Ver
    2019, 365(v2310)
    Posts
    366

    Re: screenshot and paste to email VBA

    The goal is to have a button to

    capture the active sheet,
    either paste the screenshot or save as image
    attach/paste email

  6. #6
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: screenshot and paste to email VBA

    also...if you only want to take a range from your spreadsheet...
    wouldn't it be better to just take the range of your spreadsheet to create image rather than taking screenshot instead?
    that way you dont have the excel ribbon and other things you dont really want/need in the image?

    http://www.excelforum.com/excel-prog...via-email.html
    Post #10

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: screenshot and paste to email VBA

    Quote Originally Posted by russkris View Post
    Still takes the SS of both monitors and not the active workbook or primary screen.
    You implemented it correctly.

    If you run a macro that only does AltPrintScreen, it captures only the application screen area.

    For some reason, it captures the whole screen when called within your macro. I don't know why. If i can figure it out, I'll let you know.

  8. #8
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: screenshot and paste to email VBA

    Alphafrog - that's so strange

    i can get it to work perfectly to take screenshot of VBE environment
    however if you try to screenshot just the workbook...it takes to the whole dual screen

    only way i can seem to get around it by doing what tlowry suggests which is to crop the image after being pasted

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Screenshot a particular range in Excel and paste as a bitmap
    By BadAtExcl in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-20-2016, 03:18 PM
  2. Macro needed: Capture Screenshot and email using Outlook
    By skultety in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-10-2016, 09:26 AM
  3. Macro to automatically send screenshot to an email address if cell criteria are met
    By zeegerman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-22-2015, 01:10 PM
  4. Email a screenshot of a specifc row in an email to a specfic email address
    By Cobra75007 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-19-2015, 10:36 AM
  5. User form screenshot and email in Lotus notes
    By Raanan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-21-2013, 07:06 AM
  6. Trying to get an screenshot and mail it to an email adress
    By basmienis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2012, 05:26 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1