Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sendmail questions (XP)

    1) Is it possible to include a message body when using code for sendmail?

    2) Is it possible to add an additional attachment when using code for sendmail?

    3) If the answer to any of the above are yes, can you post the code for doing so?

    Thanks in advance.

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Sendmail questions (XP)

    Check out this site:
    http://www.rondebruin.nl/sendmail.htm

    Steve

  3. #3
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sendmail questions (XP)

    Thanks for the link. I've looked around and don't see anything that helps me out. Or if something does, I'm not bright enough to figure it out.

    Here's the code I'm using right now:
    <hr>
    Sub Macro1()
    Dim cell, cell2 As Range
    Dim wb As Workbook
    Dim src, dst As Worksheet
    Dim txtSubject As String
    Set src = ThisWorkbook.Sheets(1)
    src.[E1] = "Name"
    src.[E4] = "Name"
    src.[G1] = "ID"
    src.[H1] = "Name"
    src.[I1] = "Email"
    src.[A1].CurrentRegion.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=[E4], Unique:=True

    For Each cell In src.[E4].CurrentRegion.Cells
    If cell.Row > 4 Then
    src.[E2] = cell
    src.[A1].CurrentRegion.AdvancedFilter _
    Action:=xlFilterCopy, _
    CriteriaRange:=src.Range("E1:E2"), _
    CopyToRange:=src.Range("G1:I1"), _
    Unique:=False
    src.[G1].CurrentRegion.Copy
    Set wb = Workbooks.Add
    Set dst = wb.Sheets(1)
    dst.Paste
    dst.Columns.AutoFit
    dst.[D1].Select

    txtSubject = "You have "
    txtSubject = txtSubject & dst.[A1].CurrentRegion.Rows.Count - 1
    txtSubject = txtSubject & " tickets open "
    txtSubject = txtSubject & "for July 14-20"

    ' For Each cell2 In dst.[A1].CurrentRegion.Columns(1).Cells
    'If cell2.Row > 1 Then
    ' txtSubject = txtSubject & cell2 & ", "
    'End If
    'Next cell2
    'txtSubject = Left(txtSubject, Len(txtSubject) - 2)
    wb.SendMail _
    Recipients:=dst.[C2], _
    Subject:=txtSubject
    ActiveWindow.Close SaveChanges:=False
    End If
    Next cell
    Application.CutCopyMode = False
    src.[A1].CurrentRegion.Offset(0, 4).Resize(, 5).ClearContents
    End Sub<hr>

    It sends an individual email to each individual receipient along with an Excel attachment of their tickets only. The subject tells them how many tickets are open.

    I need to body to include text (currently it's just blank) or I need an additional attachment.

  4. #4
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Sendmail questions (XP)

    The code in there has an example for sending multiple sheets.
    If you want to send something in the body of a message these are also discussed

    Have you tried running and/or stepping thru the example code to see what they do?

    Steve

  5. #5
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sendmail questions (XP)

    Well, I messed with this about as much as I could. I can get them to run independently, but can't figure out how to combine them.

    Thanks for the help. I'll play around some more as time permits.

  6. #6
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Sendmail questions (XP)

    Did you try this reference from the link? it creates a text in the body and attaches a sheet to the email using outlook.

    Steve

  7. #7
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sendmail questions (XP)

    Yeah, I've messed with it a little. I'm not savvy enough to combine these to get them combined.

    If I ever come up with it, I'll post it here.

Posting Permissions

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