-1
I declared a variable to go from line to line with a repeat loop For
to write the emails.
Works all neat until you get to the append part of the file, it shows the error image below.
I have tried to change the path several times, change the name of the files, but nothing works.
Base structure:
Code:
Sub enviar_email()
Set objeto_outlook = CreateObject("Outlook.Application")
For linha = 2 To 6
Set Email = objeto_outlook.createitem(0)
Email.display
Email.to = Cells(linha, 1).Value
Email.Subject = "Testando"
Email.Body = Cells(linha, 2).Value & "," & Chr(10) & Chr(10) _
& Cells(linha, 3).Value & Chr(10) & Chr(10) _
& "Att," & Chr(10) & "Rafael"
Email.Attachments.Add (ThisWorkbook.Path & "C:\CoParticipacoes\Excel\Participacoes\" & Cells(linha, 2).Value & ".pdf")
Email.send
Next
End Sub
IT WORKED!!!! Thank you!!! { <3 }
– rafael bueno
Great, happy to help. Signals as appropriate response, can help someone else in the future.
– Jean Barbosa