Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VBA - Sending Outlook mail with Notify 1

Status
Not open for further replies.

njitter

Technical User
Sep 4, 2001
122
0
0
US
Hello,

i'm sending an email from outlook with the following code:

Code:
Sub MailTempWorkbook()
      
    Dim WB1 As Workbook
    Dim WB2 As Workbook
    Dim WBname As String
    
    Dim OutApp As Outlook.Application
    Dim OutMail As Outlook.MailItem
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(olMailItem)
    
    Application.ScreenUpdating = False
    Set WB1 = ActiveWorkbook
    
    Sheets(Array("Info", "Mail")).Copy

    Set WB2 = ActiveWorkbook
 
    ' It will save the new file with the ActiveSheet in D:/ with a Date and Time stamp

    WBname = "Datasheet of " & WB1.Name & " " & Format(Now, "dd-mm-yy h-mm-ss") & ".xls" 'Temp file
    WB2.SaveAs "d:/" & WBname
            
    With OutMail
        .To = MailTO                                  'To
        .CC = MailCC                                  'CC
        .Subject = WBname                             'Subject
        .Body = "Analytical Data"                     'Body text
        .Attachments.Add ActiveWorkbook.FullName      'Attached Excel File
        .DeleteAfterSubmit = True                     'No copy in Sent Items
        .Send                                         'Send mail
    End With
    Set OutMail = Nothing
    Set OutApp = Nothing
        
  WB2.Close False                                            'Close the Workbook
  
'If you not want to delete the file you send delete this line

Kill "d:/" & WBname
   
Set WB1 = Nothing
Set WB2 = Nothing
Application.ScreenUpdating = True

Exit Sub

End Sub

I would like to turn the following Notifications on:

- Delivery Receipt
- Read Receipt

I found one property that looked promising but it didn't do anything:

.ReadReceiptRequested

---
It's never too late to do the Right thing
 
You may try this:
...
.OriginatorDeliveryReportRequested = True
.ReadReceiptRequested = True
.Send
...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That one worked. Thanx!!



---
It's never too late to do the Right thing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top