Results 1 to 6 of 6

Save Email as Draft

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-20-2007
    MS-Off Ver
    2003 & 2007
    Posts
    299

    Save Email as Draft

    I am using the following code to send emails, it's from Ron DeBruin's site. It works, but how can I edit so that it doesn't send the file, but saves it to your drafts??

    'Email File
    Application.DisplayAlerts = False
    Dim cell As Range
    Dim strto As String
    Dim newwb As Workbook
    Set newwb = ActiveWorkbook
        For Each cell In newwb.Sheets("Sheet1").Range("A1:A10")
            If cell.Value Like "?*@?*.?*" Then
                strto = strto & cell.Value & ";"
            End If
        Next cell
        If Len(strto) > 0 Then strto = Left(strto, Len(strto) - 1)
    Dim strbody As String
        strbody = "Hi there" & vbNewLine & vbNewLine & _
                  "This is line 1" & vbNewLine & _
                  "This is line 2" & vbNewLine & _
                  "This is line 3" & vbNewLine & _
                  "This is line 4"
        Dim OutApp As Object
        Dim OutMail As Object
    
        Set OutApp = CreateObject("Outlook.Application")
        OutApp.Session.Logon
        Set OutMail = OutApp.CreateItem(0)
    
        On Error Resume Next
        With OutMail
            .To = strto
            .CC = ""
            .BCC = ""
            .Subject = "This is the Subject line"
            .Body = strbody
            .Attachments.Add ActiveWorkbook.FullName
            .Send
        End With
        On Error GoTo 0
        Set OutMail = Nothing
        Set OutApp = Nothing
    End Sub
    Last edited by erock24; 05-20-2009 at 10:44 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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