+ Reply to Thread
Results 1 to 15 of 15

Take screenshot and attach to email

  1. #1
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    477

    Take screenshot and attach to email

    Hi all,

    I want to use VBA to take a screenshot and send as an email attachment (not email body). Below code is what I've got so far. It does successfully take a screenshot and save it to the clipboard, however, it does not let me "paste" or "attach" it to the email... Any ideas?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    7,587

    Re: Take screenshot and attach to email

    Are you wanting a screenshot of a specific range within excel spreadsheet ...
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere.....
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember......Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    477

    Re: Take screenshot and attach to email

    Just a general screenshot of Excel or the windows screen...

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    7,587

    Re: Take screenshot and attach to email

    Give this a go...
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    477

    Re: Take screenshot and attach to email

    Thanks! That seems to work, will need to do more testing on Monday though
    Last edited by esbencito; 07-29-2019 at 03:06 AM.

  6. #6
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    477

    Re: Take screenshot and attach to email

    Is this feasible as well without having to save the image to a folder first?

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    7,587

    Re: Take screenshot and attach to email

    What would there be to attach...

  8. #8
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    477

    Re: Take screenshot and attach to email

    I have read about a method where the "word object model" is used for pasting images from the clipboard directly. Unfortunately I don't seem to get it to work.

    https://www.slipstick.com/developer/...-contents-vba/

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    7,587

    Re: Take screenshot and attach to email

    So you are wanting to paste the image into the body of the email and not attach it as a file...See if this helps...
    https://excel-macro.tutorialhorizon....k-using-excel/
    https://social.msdn.microsoft.com/Fo...forum=exceldev
    Last edited by sintek; 07-30-2019 at 02:51 AM.

  10. #10
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    477

    Re: Take screenshot and attach to email

    I don't, I want it as an attachment and was hoping that this method can be used for that as well...

  11. #11
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    7,587

    Re: Take screenshot and attach to email

    So why would you want to fix something if it ain't broken...Does post 4 not work for your requirement...

  12. #12
    Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    510

    Re: Take screenshot and attach to email

    my apologies if i'm crossposting

    @sintek if i'm using gmail how do i send the email with the attachment?

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Business (Win 10 - Work) & MS 365 Subscription Insider (Win 10 - Home)
    Posts
    40,674

    Re: Take screenshot and attach to email

    Administrative Note:

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

  14. #14
    Valued Forum Contributor PaulSP8's Avatar
    Join Date
    11-21-2017
    Location
    Chorley, England
    MS-Off Ver
    2013
    Posts
    388

    Re: Take screenshot and attach to email

    Quote Originally Posted by esbencito View Post
    Is this feasible as well without having to save the image to a folder first?
    As sintek says, you need to save the file to be able to attach it, you can't just magically have a file appear as an attachment without it existing.

    You can however delete it once you're done with it, stick this line at the end of the code and it'll be like it never existed.

    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    510

    Re: Take screenshot and attach to email

    my apologies, i will start a new thread
    Last edited by AliGW; 07-31-2019 at 03:15 AM. Reason: Please don't quote unnecessarily!

+ 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. Email a screenshot of specific cells from Excel
    By BarnieFife in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2019, 04:55 AM
  2. screenshot and paste to email VBA
    By russkris in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-28-2017, 01:09 AM
  3. 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
  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. attach different worksheet and email them tdifferent email address through macro/vba/addin
    By arunverma004 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-03-2014, 08:20 AM
  6. SaveAs PDF and attach to email macro won't attach?!
    By Rerock in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2012, 05:28 PM
  7. 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

Tags for this Thread

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