Please see attached picture for code and error i'm getting.Screenshot 2025-04-21 100734.jpg
Please see attached picture for code and error i'm getting.Screenshot 2025-04-21 100734.jpg
I just figured it out. I was being dumb, hehe. I was setting the DeferredDeliveryTime after the .Send
Do you believe you could mark this thread as Solved then?
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
An alternative method
Sub ScheduleOutlookEmail() Dim olApp As Object 'Outlook.Application Dim olMail As Object 'Outlook.MailItem Dim SendDateTime As Date Dim Recipient As String Dim Subject As String Dim Body As String ' Configuration Recipient = InputBox("Enter the recipient's email address:") If Recipient = "" Then Exit Sub ' User cancelled Subject = InputBox("Enter the subject of the email:") If Subject = "" Then Exit Sub ' User cancelled Body = InputBox("Enter the body of the email:") If Body = "" Then Exit Sub ' User cancelled ' Get the desired send date and time from the user On Error Resume Next SendDateTime = InputBox("Enter the date and time to send the email (e.g., yyyy/mm/dd hh:mm):", , _ Format(Now + TimeSerial(0, 5, 0), "yyyy/mm/dd hh:mm")) ' Default 5 minutes from now On Error GoTo 0 ' Check if the entered date/time is valid If Not IsDate(SendDateTime) Then MsgBox "Invalid date or time entered. Please try again.", vbExclamation Exit Sub End If If SendDateTime <= Now Then MsgBox "The scheduled time must be in the future. Please try again.", vbExclamation Exit Sub End If ' Create and Schedule the Email On Error Resume Next Set olApp = GetObject(, "Outlook.Application") On Error GoTo 0 If olApp Is Nothing Then Set olApp = CreateObject("Outlook.Application") End If Set olMail = olApp.CreateItem(0) ' olMailItem With olMail .To = Recipient .Subject = Subject .Body = Body .DeferredDeliveryTime = SendDateTime .Display ' Optionally display the email for review before scheduling '.Send ' Uncomment this to send immediately (without scheduling) End With Set olMail = Nothing Set olApp = Nothing MsgBox "Email to '" & Recipient & "' scheduled to be sent at " & Format(SendDateTime, "yyyy/mm/dd hh:mm") & ".", vbInformation End Sub
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link