Error Sending Emails with vba

Need a help trouble shooting my outlook vba code process (below)

Before I run this code I create a series of emails using Microsoft Mail merge

I run the process and it creates the emails (may as few as one email or hundreds of emails )

This is done with outlook enterprise offline

I the move the emails to a subfolder of the inbox and run the following code to add attachments and build in a delay if there are a lot of emails to send

At .send the macro stalls and give me an error message "Runtime error '-2147467259 (80004005): This method can't be used with an inline response mail item."

Sub a_Introduce_EPM_To_New_Clients()
    Dim mai As MailItem 'Object
    Dim acct As Long
    Dim Delay As Date, Start As Date, n As Integer
    Dim UpdtCount As Integer
    Dim FirstNm As String
    Dim AddAttachment As Integer
    Dim EmailsPerHour As Integer
    Dim FolderCheck As Integer, FolderName As String
    Dim EmailNo As Integer
    Dim ofldr As Object
    
    Dim AddAttachmentIntroEmail As Integer
        
    Dim recips As Outlook.Recipients
    Dim recip As Outlook.Recipient
    Dim pa As Outlook.propertyAccessor
    Const PR_SMTP_ADDRESS As String = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
    
    EmailNo = 1
   
    MsgBox "Select Email Folder"
    Set ofldr = Session.PickFolder

    AddAttachment = MsgBox("Do You Want to Add Listed Project Attachments", vbYesNo + vbDefaultButton2)
    AddAttachmentIntroEmail = MsgBox("Is this an Introduction Email?" & vbNewLine & vbNewLine & "Add Services Attachments?", vbYesNo + vbDefaultButton2)
'01-16-2018------------------
    If ofldr.Items.Count < 30 Then
        EmailsPerHour = InputBox("How Many Emails Per Hour do you want to send?" & vbNewLine & vbNewLine & "there are " & ofldr.Items.Count & " Emails in folder " & ofldr.Name, , ofldr.Items.Count)
    Else
        EmailsPerHour = InputBox("How Many Emails Per Hour do you want to send?" & vbNewLine & vbNewLine & "there are " & ofldr.Items.Count & " Emails in folder " & ofldr.Name, , 30)
    End If
'01-16-2018------------------
    Delay = Now() ' + 3 / 24 ' + 1 ' / 24
    n = 0
    Delay = DateAdd("n", 1, Delay) ' adds 5 minutes
    Start = Delay
    MsgBox Start
    UpdtCount = 0
    maiItem = 1 '01-18-2018
        Do While ofldr.Items.Count > 0
        
           Set mai = ofldr.Items(maiItem)
            If mai.Class = olMail Then
                With mai
                    
                    .Importance = olImportanceHigh
                    .ReadReceiptRequested = True
                    .OriginatorDeliveryReportRequested = True
                If AddAttachmentIntroEmail = 6 Then
                    .Attachments.Add "J:\Marketing\_Introduce EPM to New Clients\Typical CASp Services Available from EPM (Tailored).pdf"
                    .Attachments.Add "J:\Marketing\_Introduce EPM to New Clients\EPM Owners Representative - Project Manager 10-24-2014.pdf"
                    .Attachments.Add "J:\Marketing\_Introduce EPM to New Clients\Typical EPM Owner Rep - CM Menu of Services.pdf"
                ElseIf AddAttachment = 6 Then
'                    .Attachments.Add "J:\16 Jobs\16038 Sunset Center Water Damage\Construction Management\Bidding\Addenda\Trellis Addendum 01\16038 Sunset Water Damage Trellis Repair Addendum 01 01-30-2017 Combined Ref Info.pdf"
                End If
                    .DeferredDeliveryTime = Delay
            
                    UpdtCount = UpdtCount + 1
                    
                    If EmailsPerHour >= ofldr.Items.Count Then EmailsPerHour = ofldr.Items.Count
                    
                    If UpdtCount = EmailsPerHour Then
                        Delay = DateAdd("n", 60, Delay) ' adds 60 minutes
                        UpdtCount = 0
                        n = n + 1
                    End If
                    
On Error GoTo SendFail
                    .Send
SendFail:
'                    .Save
                End With
                
                EmailNo = EmailNo + 1
                UserForm1.TextBox1 = EmailNo & " UpdtCount  = " & UpdtCount
                UserForm1.TextBox2 = "Delay = " & Delay
                UserForm1.Show vbModeless
                DoEvents
            End If
            
    '++++++++++++++++++++++++++++===
    ''+++Sue Mosher   14-May-2003  17:45
    ''+++DeferredDeliveryTime takes a date/time value. (You can look these things up in Help -- in VBA,
    ''+++press F2 to get the object browser, select the property, then press F1.)
    ''+++You can use the DateAdd() function to add 15 minutes to the current date/time:
    ''+++dteThen = dateadd("n", 15, Now)
    ''+++objMail.DeferredDeliveryTime = dteThen
    '++++++++++++++++++++++++++++===
        
        
            Loop
    Unload UserForm1
        
    MsgBox "Start = " & Start & vbNewLine & "End = " & Delay
End Sub

Open in new window

rogerdjrAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorieAnalyst Assistant Commented:
Where do you get the error?
0
rogerdjrAuthor Commented:
at the .send command
0
rogerdjrAuthor Commented:
Thanks for adding the tags - how can I do that for future questions?
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Martin LissOlder than dirtCommented:
Select your code and then click the indicated icon.
Here's how.
0
rogerdjrAuthor Commented:
thanks
0
Martin LissOlder than dirtCommented:
It may not be the cause of your problem but 'maiItem' is not defined which points out that you should always have OPTION EXPLICIT at the top of you code.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rogerdjrAuthor Commented:
Wow that fixed it!!! thanks
0
Martin LissOlder than dirtCommented:
Please don't forget to close the question.
0
Martin LissOlder than dirtCommented:
You’re welcome and I’m glad I was able to help.

If you expand the “Full Biography” section of my profile you’ll find links to some articles I’ve written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2017
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.