April 2006
Beginner
1114 pages
98h 16m
English
mailitem.ExpiryTime [= setting]
Sets or returns date value when the email expires and will be automatically deleted. The following code sends a message that expires in two days:
Sub SendMessageWithExpiration( )
Dim ws As Worksheet, mi As MailItem
' Get the active worksheet.
Set ws = ActiveSheet
' Show email header.
ws.Parent.EnvelopeVisible = True
' Get the MailItem object
.
Set mi = ws.MailEnvelope.Item
' Set MailItem properties.
mi.To = "someone@microsoft.com"
mi.Subject = "Message will self-destruct " & Now + 2
' Expires in two days
mi.ExpiryTime = Now + DateSerial(0, 0, 2)
End SubRead now
Unlock full access