Erro em tempo de ex...
 
Notifications
Clear all

Erro em tempo de execução '1004'

1 Posts
1 Usuários
0 Likes
565 Visualizações
joaorlneto
(@joaorlneto)
Posts: 49
Trusted Member
Topic starter
 

Boa tarde.

 

Estou tentando incluir esta macro com o intuito de disparar vários e-mails ao mesmo tempo. Neste caso cada cliente recebe sua informação especifica. 

No momento que executo a macro, volta com o erro:

"Erro em tempo de execução '1004':

"Erro de definição de aplicativo ou de definição de objeto"

 

Segue a macro que estou querendo executar:

Sub Enviar_Email_GERAL()

ActiveWorkbook.Save
Sheets("RODOBORGES").Select
Range("B2:P12").Select
ActiveWorkbook.EnvelopeVisible = False
With ActiveSheet.MailEnvelope

.Introduction = "Boa tarde." & vbNewLine & "Segue abaixo a distribuição das entregas de açúcar referente aos próximos dias." & vbNewLine & "-"
.Item.To = "joao.rodrigues@deltasucroenergia.com.br"
.Item.CC = ""
.Item.Subject = "DISTRIBUIÇÃO SEMANAL - RODOBORGES"
.Item.Send

End With

Sheets("LOGFAZ").Select
Range("B2:P12").Select
ActiveWorkbook.EnvelopeVisible = False
With ActiveSheet.MailEnvelope

.Introduction = "Boa tarde." & vbNewLine & "Segue abaixo a distribuição das entregas de açúcar referente aos próximos dias." & vbNewLine & "-"
.Item.To = "joao.rodrigues@deltasucroenergia.com.br"
.Item.CC = ""
.Item.Subject = "DISTRIBUIÇÃO SEMANAL - LOGFAZ"
.Item.Send

End With

Sheets("J.V.S.").Select
Range("B2:P12").Select
ActiveWorkbook.EnvelopeVisible = False
With ActiveSheet.MailEnvelope

.Introduction = "Boa tarde." & vbNewLine & "Segue abaixo a distribuição das entregas de açúcar referente aos próximos dias." & vbNewLine & "-"
.Item.To = "joao.rodrigues@deltasucroenergia.com.br"
.Item.CC = ""
.Item.Subject = "DISTRIBUIÇÃO SEMANAL - J.V.S."
.Item.Send

End With

Sheets("CQ").Select
Range("B2:P12").Select
ActiveWorkbook.EnvelopeVisible = False
With ActiveSheet.MailEnvelope

.Introduction = "Boa tarde." & vbNewLine & "Segue abaixo a distribuição das entregas de açúcar referente aos próximos dias." & vbNewLine & "-"
.Item.To = "joao.rodrigues@deltasucroenergia.com.br"
.Item.CC = ""
.Item.Subject = "DISTRIBUIÇÃO SEMANAL - CQ"
.Item.Send

End With

Sheets("ED. REQUI").Select
Range("B2:P12").Select
ActiveWorkbook.EnvelopeVisible = False
With ActiveSheet.MailEnvelope

.Introduction = "Boa tarde." & vbNewLine & "Segue abaixo a distribuição das entregas de açúcar referente aos próximos dias." & vbNewLine & "-"
.Item.To = "joao.rodrigues@deltasucroenergia.com.br"
.Item.CC = ""
.Item.Subject = "DISTRIBUIÇÃO SEMANAL - ED. REQUI"
.Item.Send

End With

Sheets("RODUNI").Select
Range("B2:P12").Select
ActiveWorkbook.EnvelopeVisible = False
With ActiveSheet.MailEnvelope

.Introduction = "Boa tarde." & vbNewLine & "Segue abaixo a distribuição das entregas de açúcar referente aos próximos dias." & vbNewLine & "-"
.Item.To = "joao.rodrigues@deltasucroenergia.com.br"
.Item.CC = ""
.Item.Subject = "DISTRIBUIÇÃO SEMANAL - RODOUNI"
.Item.Send

End With

Sheets("JR").Select
Range("B2:P12").Select
ActiveWorkbook.EnvelopeVisible = False
With ActiveSheet.MailEnvelope

.Introduction = "Boa tarde." & vbNewLine & "Segue abaixo a distribuição das entregas de açúcar referente aos próximos dias." & vbNewLine & "-"
.Item.To = "joao.rodrigues@deltasucroenergia.com.br"
.Item.CC = ""
.Item.Subject = "DISTRIBUIÇÃO SEMANAL - JR"
.Item.Send

End With

End Sub

 

Lembrando que quando eu executo essa macro por cliente separado "um a um" ela funciona normal. 

Sub Enviar_Email_RODOBORGES()

ActiveWorkbook.Save
Sheets("RODOBORGES").Select
Range("B2:P12").Select
ActiveWorkbook.EnvelopeVisible = False
With ActiveSheet.MailEnvelope

.Introduction = "Boa tarde." & vbNewLine & "Segue abaixo a distribuição das entregas de açúcar referente aos próximos dias." & vbNewLine & "-"
.Item.To = "joao.rodrigues@deltasucroenergia.com.br"
.Item.CC = ""
.Item.Subject = "DISTRIBUIÇÃO SEMANAL - RODOBORGES"
.Item.Send

End With

End Sub

João Neto

 
Postado : 30/03/2022 12:24 pm