View Single Post
 
Old 02-19-2021, 03:48 AM
JamesWood JamesWood is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Nov 2020
Posts: 37
JamesWood is on a distinguished road
Default

Hi guys


Nevermind the above, I've come up with a workaround. Essentially I have ended up with a macro that sends all the drafts in a particular drafts folder (in this case, Merge Tools). I was also getting an 'inline' error whilst using this because I was viewing the draft it was trying to send, so I made it switch to the Inbox view before sending the drafts. Here's the code for anyone who wants it


Sub SendAllMergeToolsDrafts()

If MsgBox("Are you sure you want to send ALL the items in your Merge Tools drafts folder?", _
vbQuestion + vbYesNo) <> vbYes Then Exit Sub

Dim myNamespace As Outlook.NameSpace 'Change view to Inbox to avoid inline error
Set myNamespace = Application.GetNamespace("MAPI") 'Change view to Inbox to avoid inline error
Set Application.ActiveExplorer.CurrentFolder = _
myNamespace.GetDefaultFolder(olFolderInbox) 'Change view to Inbox to avoid inline error

Dim fldDraft As MAPIFolder, msg As Outlook.MailItem, intCount As Integer
Set fldDraft = Outlook.GetNamespace("MAPI").GetDefaultFolder(olFo lderDrafts).Folders("Merge Tools") 'Sends all drafts in the Merge Tools folder only
intCount = 0
Do While fldDraft.Items.count > 0
Set msg = fldDraft.Items(1)
msg.Send
intCount = intCount + 1
Loop
If Not (msg Is Nothing) Then Set msg = Nothing
Set fldDraft = Nothing
MsgBox intCount & " messages sent", vbInformation + vbOKOnly

End Sub
Reply With Quote