I have a program that dumps hundreds of draft emails into my Outlook's draft folder. In order to send them from there, I wrote a quick VB macro so that I didn't have to open each one and hit "send". My problem with the macro is that, every time you run it, it only sends exactly half the emails. I'm sure I've done something very obviously wrong but it's so obvious that, after staring at it for an hour, I can't see it. Can anyone help, please??
-------------
Code:
-------------
Sub Send_drafts()
Dim oNS As Outlook.NameSpace
Dim oFld As Outlook.MAPIFolder
Dim oItems As Outlook.Items
Dim oItem As Object
Set oNS = Application.GetNamespace("MAPI")
Set oFld = oNS.GetDefaultFolder(olFolderDrafts)
For Each oItem In oFld.Items
If oItem.To <> "" Then
oItem.Send
End If
Next
End Sub







Sign In
Register
Help
Add Reply


Back to top
MultiQuote

