automatic send of emails in MS Outlook

L

Lewis

Hi

Is there a way of automatically sending emails from an outlook drafts
box without going into each mail and clicking "send".

Thanks for any help

Lewis
 
M

Michael Bauer [MVP - Outlook]

You might do that with a few lines of VBA:

Public Sub SendSelectedMail()
Dim Sel As Outlook.Selection
Dim obj As Object

Set Sel = Application.ActiveExplorer.Selection
If Sel.Count Then
Set obj = Sel(1)
If TypeOf obj Is Outlook.MailItem Then
obj.Send
End If
End If
End Sub

By customizing your commandbar you can add a button to start that macro:
right click on a commandbar, Customize/Commands/Macros, drag the macro's
name onto the bar. With another right click on the new button you might also
change its face.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>


Am Thu, 05 Jul 2007 08:41:44 -0700 schrieb Lewis:
 
L

Lewis

Hello Michael,

Thanks for that it works brilliantly. However, it will only send one
email per click of the macro button, is there a way to tweak the code
to send multiple items once highlighted.
Thank you.

Lewis
 
M

Michael Bauer [MVP - Outlook]

That would be:

Public Sub SendSelectedMail()
Dim Sel As Outlook.Selection
Dim obj As Object
Dim i&

Set Sel = Application.ActiveExplorer.Selection
For i=1 to Sel.Count
Set obj = Sel(i)
If TypeOf obj Is Outlook.MailItem Then
obj.Send
End If
Next
End Sub

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>


Am Fri, 06 Jul 2007 01:27:54 -0700 schrieb Lewis:
 
L

Lewis

That would be:

Public Sub SendSelectedMail()
Dim Sel As Outlook.Selection
Dim obj As Object
Dim i&

Set Sel = Application.ActiveExplorer.Selection
For i=1 to Sel.Count
Set obj = Sel(i)
If TypeOf obj Is Outlook.MailItem Then
obj.Send
End If
Next
End Sub

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail =en&pub=6>

Am Fri, 06 Jul 2007 01:27:54 -0700 schrieb Lewis:

Hello Michael

Thank you for that you have bailed me out of a big hole, I now have a
happy customer.
Cheers
Lewis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top