Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Mar 2012
    Posts
    78
    Thanks
    20
    Thanked 0 Times in 0 Posts

    E-mail code in Excel

    Hi

    I have the following code where I attach one sheet of a workbook but now I need to adjust the code to attach several sheets. The sheets all begin with ChkptTS--example ChkptTS1, ChkptTS2, ChkptTS3 and so on. The code is attaching the entire workbook and I want just the sheets in my example. The code pops up with the email but then I never get the email.

    Code:
    Sub Auto_Email()
    
    For Each ws In Sheets
    If Not ws.Name Like "ChkptTS*" Then
    End If
    Next
    Application.Dialogs(xlDialogSendMail).Show "jjkbmiller1907@att.net", "Reporting ..."
    ActiveWindow.WindowState = xlMinimized
    For Each ws In Sheets
    If Not ws.Name Like "ChkptTS*" Then
    ws.Visible = xlSheetVisible
    End If
    Next
    
    End Sub

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Jean,

    You can't attach individual sheets directly as the attachment function attaches files.
    You have two options as I see it.

    1. Copy the desired sheets, one at a time, to a new workbook, save it, attach it, delete it, repeat.

    2. Print the desired sheets to a PDF then attach the PDF file. This of course is the quicker option since you could select the desired sheets and then print the selected sheets in one fell swoop.

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. The Following User Says Thank You to RetiredGeek For This Useful Post:

    JeanM (2015-02-21)

  4. #3
    Star Lounger
    Join Date
    Mar 2012
    Posts
    78
    Thanks
    20
    Thanked 0 Times in 0 Posts
    Hi

    I actually got it to work. It took forever to show up in my email and I have the workbook with just the sheets I wanted. Sorry that I was not more patient with my email delivery.

    Jean

  5. #4
    Star Lounger
    Join Date
    Dec 2009
    Location
    Findlay, Ohio
    Posts
    57
    Thanks
    4
    Thanked 6 Times in 6 Posts
    here is a great example I used to send all the sheets of an excel to in the body of an email
    It needed a little work but I can send all sheets in an xls in the body of an email after a little rewrite.
    http://www.mrexcel.com/forum/excel-q...ody-email.html

  6. The Following User Says Thank You to orangehat For This Useful Post:

    JeanM (2015-02-21)

Posting Permissions

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