Excel: Use Email without Outlook?

hobbish

New Member
Joined
Oct 28, 2006
Messages
2
Hi,
Wondering if is possible to check the neccessary boxes i want to generate email with a click on the button, without the use of outlook to send email? What VBA codes would i need to make it happen?

Thanks!
 

Some videos you may like

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

hobbish

New Member
Joined
Oct 28, 2006
Messages
2
Hey DominicB,
Thanks for your reply. However, i would require some coding and i manage to find one. But apparently it doesnt work. please kindly show me some light.

Private Sub CommandButton1_Click()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range

Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon

On Error GoTo cleanup
For Each cell In Sheets("Sheet3").Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And LCase(cell.Offset(0, 1).Value) = "yes" _
And LCase(cell.Offset(0, 2).Value) <> "send" Then
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "Reminder"
.Body = "Dear " & cell.Offset(0, -1).Value & vbNewLine & vbNewLine & _
"Please be reminded of the outstanding loan"
'You can add files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'Or use Display
End With
On Error GoTo 0

cell.Offset(0, 2).Value = "send"
Set OutMail = Nothing
End If
Next cell

cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,109,329
Messages
5,528,033
Members
409,799
Latest member
mlewan_ca

This Week's Hot Topics

Top