PDA

View Full Version : Run Time Error 438



Samer
07-15-2018, 12:12 AM
hi guys,
could you please help me to solve the error( the error comes from Bolded line)


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

Paul_Hossler
07-15-2018, 07:58 AM
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