Consulting

Results 1 to 10 of 10

Thread: Solved: Email ONLY current page

  1. #1
    VBAX Regular
    Joined
    Nov 2006
    Posts
    7
    Location

    Question Solved: Email ONLY current page

    I have a macro that creates an outlook session and creates an email with a distribution list I only want to send the summary sheet of the workbook not the whole workbook

    How do i copy one sheet into the body of an email?

  2. #2
    If you only wish to send one Worksheet from a Workbook you can use the method shown below. It creates a new Workbook housing ONLY the sheet that copy. It then sends the 1 sheet Workbook as an attachment, then closes the new Workbook without saving.

    Sub Send1Sheet_ActiveWorkbook()
        'Create a new Workbook Containing 1 Sheet _
         and sends as attachment.
            With ActiveWorkbook
                 .Sheets(1).Copy
                 .SendMail Recipients:="dump@vbaexpress.com", _
                  Subject:="Try Me " & Format(Date, "dd/mmm/yy")
                 .Close SaveChanges:=False
            End With
        End Sub
    HTH
    ilyaskazi

  3. #3

  4. #4
    Administrator
    Chat VP
    VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  5. #5
    VBAX Regular
    Joined
    Nov 2006
    Posts
    7
    Location
    Had already thought of that as a fall back option.
    I can copy the page to the clipboard using:

    Range("a1:d11").CopyPicture xlScreen, xlBitmap

    I just dont know how to them copy it down from the clipboard to the body of the email

  6. #6
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Manually... click File > Send To, leave the option "Send the current sheet as the message body" checked, then click OK...
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  7. #7
    VBAX Regular
    Joined
    Nov 2006
    Posts
    7
    Location
    Anybody know the vba code to do this - when i record i get nothing

  8. #8
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    To do what? If you're referring to my last post, follow the link in my first post.

    If you're referring to copying from the clipboard to the body of the email - there's no need, Excel has the built-in functionality to do this without a copy-paste
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  9. #9
    VBAX Regular
    Joined
    Nov 2006
    Posts
    7
    Location
    Sorry - missing something here
    I can do the send the current sheet as the body of an email manually by following the menu path as click File > Send To, leave the option "Send the current sheet as the message body"
    But i need to do this as vba code

  10. #10
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Quote Originally Posted by Kippers
    Sorry - missing something here
    I can do the send the current sheet as the body of an email manually by following the menu path as click File > Send To, leave the option "Send the current sheet as the message body"
    But i need to do this as vba code
    ????? Can't you read? I'll assume you don't know how to scroll back up the page....

    Click >> HERE << to get your code
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

Posting Permissions

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