-
Run Time Error 438
hi guys,
could you please help me to solve the error( the error comes from Bolded line)
Code:
Sub SendReminderMail()
Dim OutLookApp As Object
Dim OutLookMailItem As Object
Dim iCounter As Integer
Dim MailDest As String
Dim Mailsubject As String
Set OutLookApp = CreateObject("Outlook.application")
Set OutLookMailItem = OutLookApp.CreateItem(0)
With OutLookMailItem
MailDest = ""
For iCounter = 1 To WorksheetFunction.CountA(Columns(5))
If MailDest = "" And Cells(iCounter, 5).Offset(0, -1) = "Send Reminder" Then
MailDest = Cells(iCounter, 5).Value
ElseIf MailDest <> "" And Cells(iCounter, 5).Offset(0, -1) = "Send Reminder" Then
MailDest = MailDest & ";" & Cells(iCounter, 5).Value
End If
Next iCounter
Mailsubject = ""
For iCounter = 1 To WorksheetFunction.CountA(Columns(1))
If Mailsubject = "" And Cells(iCounter, 1).offest(0, -1) = "Send Reminder" Then
Mailsubject = Cells(iCounter, 1).Value
ElseIf Mailsubject <> "" And Cells(iCounter, 1).Offset(0, -1) = "Send Reminder" Then
Mailsubject = Mailsubject & ";" & Cells(iCounter, 1).Value
End If
Next iCounter
.To = MailDest
.subject = Mailsubject
.Body = "Reminder: ."
.Send
End With
Set OutLookMailItem = Nothing
Set OutLookApp = Nothing
End Sub
-
1. I added CODE tags around your macro - you can use the [#] inco next time
2. You probably wanted .Offset, not .Offest in that line