Consulting

Results 1 to 2 of 2

Thread: Run Time Error 438

  1. #1
    VBAX Newbie
    Joined
    Jul 2018
    Posts
    1
    Location

    Run Time Error 438

    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
    Last edited by Paul_Hossler; 07-15-2018 at 07:57 AM.

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    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
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •