D
Dudely
I'm trying to mail something to a list of addresses in my
spreadsheet. As best as I can tell, everything works fine EXCEPT, the
mail never seems to go out. I don't believe there are any errors
being returned as I step through it and it seems to execute each
statement just fine. Any ideas? Here's the function. I have Office
2000 installed on WinXP.
Sub mailMessage()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim strBody As String
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Call getBody(strBody)
On Error GoTo cleanup
For Each cell In
Sheets("Sheet1").Columns("A").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And LCase(cell.Offset(0,
2).Value) = "yes" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "Enter Subject Here"
.Body = strBody
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
spreadsheet. As best as I can tell, everything works fine EXCEPT, the
mail never seems to go out. I don't believe there are any errors
being returned as I step through it and it seems to execute each
statement just fine. Any ideas? Here's the function. I have Office
2000 installed on WinXP.
Sub mailMessage()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim strBody As String
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Call getBody(strBody)
On Error GoTo cleanup
For Each cell In
Sheets("Sheet1").Columns("A").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And LCase(cell.Offset(0,
2).Value) = "yes" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "Enter Subject Here"
.Body = strBody
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub