+ Reply to Thread
Results 1 to 7 of 7

Macro to take a screenshot and bundle into body of Outlook

Hybrid View

  1. #1
    Registered User
    Join Date
    12-20-2013
    Location
    Saskatchewan
    MS-Off Ver
    2010
    Posts
    3

    Question Macro to take a screenshot and bundle into body of Outlook

    This is only my 3rd VBA that I am working on and struggling to get something where I can:
    - take a screenshot of 'part' of an excel worksheet
    - paste it in the 'body' of an email

    I have tried much googling but no luck. I found this but not quite able to make it work/understand it.
    Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
    Here is what I have written so far. Sorry if its so messy ... like I said, its only my 3rd one.

    Sub Reconcile2()
         Dim OutApp As Object
         Dim OutMail As Object
         Dim Range As Range
         Dim sMsgBody As String
     
    sMsgBody = "This Order is for: " & vbCr & vbCr
    sMsgBody = sMsgBody & "Name:               " & Worksheets("sheet1").Range("c3") & vbCr
    sMsgBody = sMsgBody & "Account # DEBITED:         " & Worksheets("sheet1").Range("d38") & vbCr
    sMsgBody = sMsgBody & "Amount Debited:              $" & Worksheets("sheet1").Range("j38") & vbCr
    sMsgBody = sMsgBody & "Additional Details for Completion:  " & Worksheets("sheet1").Range("D26")
    'sMsgBody = sMsgBody & "The vbcr means skip a line, and if " & vbCr
    'sMsgBody = sMsgBody & " you place to of them you will skip 2 lines." & vbCr & vbCr
    'sMsgBody = sMsgBody & "Thank you," & vbCr & vbCr
    'sMsgBody = sMsgBody & "John"
    
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)
    
    
        With OutMail
        .To = "me@home.com"
            '.To = sTo
            '.CC = "you@home.com"
            .BCC = ""
            .Subject = "Order for " & Worksheets("sheet1").Range("I6") & " Branch Created"
            .body = sMsgBody
            .display
    
      Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
         
    End With
    End Sub
    Any specific details/explanation would be appreciated. Thanks in 'advance' for your help.

    Kathleen

  2. #2
    Registered User
    Join Date
    12-20-2013
    Location
    Saskatchewan
    MS-Off Ver
    2010
    Posts
    3

    Re: Macro to take a screenshot and bundle into body of Outlook

    I have made a bit more headway but I just cant wrap my head around what to do next. I have found this macro that I can tell works cause when I run it and then open WORD and just do a ctrl+v it actually pastes the screenshotthat I was expecting in. But how do I get the paste command and combine it with the rest of my code (ie: to, subject, body, etc)

    Here is the 'copy' code I found:
    Sub Macro1()
    fmta = Application.ClipboardFormats
    Range("A11:K22").Select
    Selection.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
    ' Use Watch window to examine the Clipboard formats-FmtA
    End Sub
    Honest I am trying ...

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to take a screenshot and bundle into body of Outlook

    Hi olsska

    Is the Range you wish to capture fixed or will the User select the Range?

    Please attach a Sample Workbook that's of the same structure as your Actual Workbook...propriatery information should be modified.
    Last edited by jaslake; 12-21-2013 at 05:14 PM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    12-20-2013
    Location
    Saskatchewan
    MS-Off Ver
    2010
    Posts
    3

    Re: Macro to take a screenshot and bundle into body of Outlook

    The range is fixed (A11:K22) and will never change. Here is the spreadsheet I am working with attached.
    Attached Files Attached Files

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to take a screenshot and bundle into body of Outlook

    Hi olsska

    If you're not resolved before then I'll get back to you after Christmas...have Family Stuff going on.

    Happy Holidays.

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to take a screenshot and bundle into body of Outlook

    Hi olsska

    The Code in the attached to EmailYorkton_Click has been modified to include the Image in the Body of the Email.

    Let me know of issues.

    @Norie
    Using the Data Range appears to not pick up the CheckBoxes...
    Attached Files Attached Files
    Last edited by jaslake; 12-26-2013 at 06:13 PM.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Macro to take a screenshot and bundle into body of Outlook

    Instead of a screenshot couldn't you insert the actual data into the body of the email?
    If posting code please use code tags, see here.

+ 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. 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
  2. Macro to export outlook message body to excel
    By VKS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-08-2013, 08:02 AM
  3. Macro to extract body data from Outlook messages in to Excel
    By gangup in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-23-2012, 12:21 PM
  4. Sending screenshot via outlook using excel code
    By ge0rge in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-07-2012, 05:23 AM
  5. Macro for extracting content of outlook mail body (contains table)
    By anchuri_chaitanya in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 07-14-2011, 03:29 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