Ir ao conteúdo
  • Cadastre-se

Macro vba --- salvar 2 arquivos pdf e enviar os 2 por e-mail


Posts recomendados

Bom dia a todos!

 

Tenho uma planilha com 2 abas.

Preciso imprimir essas 2 abas em pdf e anexar no mesmo e-mail.

Detalhe: o primeiro arquivo pdf precisa ser renomeado utilizando as células contidas nessa 1ª aba.

 

Tenho o código abaixo que emite o pdf e anexa o e-mail.

 

Poderiam me ajudar a colocar o outro anexo, por favor?

Não é preciso renomear o 2º anexo com células. Um nome simple é o suficiente.

 

=======================================================================

Sub PDFEMAIL()

Dim Nome As String
Dim SDate As String
Dim MyLocal As String
Dim endereco As String

MyLocal = "G:\INTERNACIONAL\SI -MODELO DE  INSTRUÇÃO DE EMBARQUE\SI MARITIMA FCL 2016\PDF\"
Shipper = Range("T12").Value
Cnee = Range("AB12").Value
PO = Range("AB6").Value
Origem = Range("T14").Value
Destino = Range("AB14").Value
Agent = Range("AB10").Value
SDate = Now
endereco = ""
T = Range("E288").Value
T1 = Range("E290").Value
T2 = Range("E291").Value
T3 = Range("E292").Value
T4 = Range("E294").Value
T5 = Range("E295").Value
T6 = Range("E297").Value
T7 = Range("E299").Value

pula = Chr(10) & Chr(13)

If MsgBox("voce quer salvar este arquivo agora ?", vbYesNo) = vbYes Then
Nome_Arq = MyLocal & "SI FCL --- " & Cnee & " --- " & Shipper & " --- " & Agent & " --- " & PO & " --- " & Day(Now) & "-" & Month(Now) & "-" & " - " & Year(Now) & ".pdf"
FileSaveName = Application.GetSaveAsFilename(Nome_Arq, fileFilter:="PDF Files (*.pdf), *.pdf")
Sheets("SEA FCL - SHIPPING INSTRUCTIONS").ExportAsFixedFormat Filename:=Nome_Arq, Type:=xlTypePDF, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
Application.DisplayAlerts = False
Else
Application.DisplayAlerts = False
End If

Set myActiveSheet = CreateObject("Outlook.Application")
Set objMail = myActiveSheet.CreateItem(olMailItem)
Set myAttachments = objMail.Attachments

With objMail
.To = endereco
.Subject = "IMPORTAÇÃO MARÍTIMA FCL --- " & Nome & " --- " & Cnee & " --- " & Shipper & " --- " & Agent & " --- " & PO & " --- " & Day(Now) & "-" & Month(Now) & Year(Now)
.Body = T _
& pula & T1 _
& pula & T2 _
& pula & T3 _
& pula & T4 _
& pula & T5 _
& pula & T6 _
& pula & T7
myAttachments.Add Nome_Arq
.Display

End With

End Sub

=============================================================

 

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

 

GRÁTIS: ebook Redes Wi-Fi – 2ª Edição

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!