You are reading a single comment by @aggi and its replies. Click here to read the full conversation.
  • guyzzz
    I'm trying to send 600 emails with an attachment.
    I've found a way to do this (google).

    i've got something that will work (from here:
    https://www.mrexcel.com/forum/excel-questions/514468-mail-merge-email-attachments-vba-2.html)

    but I've changed the end to

     With OutMail
                    .To = cell.Value
                    .Subject = "HELLOWORLD"
                    .HTMLBody = strbody
                    
     
                    For Each FileCell In rng.SpecialCells(xlCellTypeConstants)
                        If Trim(FileCell) <> "" Then
                            If Dir(FileCell.Value) <> "" Then
                                .Attachments.Add FileCell.Value
                            End If
                        End If
                    Next FileCell
     
                    .Display
                    Application.Wait (Now + TimeValue("0:00:02"))
                    Application.SendKeys "%s"
                    
    

    However when you send it, there's still a display of the email and it being sent.
    What can do?

    Especially as it's probably close to 1200 mails ackshually.

  • Remove .Display and replace with .Send and lose the two lines after that (the two lines are basically wait for two seconds and then send Alt+S which is the keyboard shortcut for send in Outlook, a bit of a workaround for someone who didn't know how to send automatically).

  • Could be wrong, but from memory I don't think you can do the .Send. I think it asks for confimation, which is why you use the Display / SendKeys to send it for you.

About

Avatar for aggi @aggi started