In a new email message OR a reply message, I want to change the delivery date and time to the next day at a certain time, say 8AM.
I want to be able to click one button in my toolbar and the date and time to be set automatically.
In a new email message OR a reply message, I want to change the delivery date and time to the next day at a certain time, say 8AM.
I want to be able to click one button in my toolbar and the date and time to be set automatically.
In your code you are creating a new MailItem instance where the MailItem.DeferredDeliveryTime property is set which stands for a date indicating the date and time the mail message is to be delivered.
Instead, you need to get the current item displayed in the inspector window in Outlook. To get this done, you need to use the ActiveInspector property which returns the topmost Inspector
object on the desktop.
Sub GetCurrentItem()
Dim myinspector As Outlook.Inspector
Dim myItem As Outlook.MailItem
Set myinspector = Application.ActiveInspector
Set myItem = myinspector.CurrentItem
End Sub