I made a macro where it opens the Outlook, up to that beauty. now I need to supplement it with the following items.
I need to get 4 tabs from my spreadsheet, generate a new file and then attach it to the email and send it.
Can anyone help me?
follow the code (this code only opens excel)
Sub MandaEmail()
Dim EnviarPara As String
Dim Mensagem As String
For i = 1 To 1
EnviarPara = Worksheets("Tabela").Cells(5, 35)
If EnviarPara <> "" Then
Mensagem = Worksheets("Tabela").Cells(6, 35)
Texto = Worksheets("Tabela").Cells(7, 35)
Envia_Emails EnviarPara, Mensagem
End If
Next i
End Sub
Sub Envia_Emails(EnviarPara As String, Mensagem As String)
Dim OutlookApp As Object
Dim OutlookMail As Object
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
With OutlookMail
.To = EnviarPara
.CC = ""
.BCC = ""
.Subject = Mensagem
.Body = "Bom dia"
.Display ' para envia o email diretamente defina o código .Send
End With
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub