Private Sub VisualizarEmPDF_Click()
Dim assinatura As Variant
Dim blRet As Boolean
Dim SqlF As String
Dim cr As Recordset
Dim reduz, Email,
SqlF = "SELECT SA1.A1_COD, SA1. A1_NREDUZ “
SqlF = SqlF & " SA1.A1_EMLCOM “
SqlF = SqlF & " FROM SA1"
SqlF = SqlF & " WHERE (SA1.A1_COD)=" & "'" & [Forms]![CotacoesCC_TI].[Cliente] & "'"
Set cr = CurrentDb.OpenRecordset(SqlF)
reduz = cr("A1_NREDUZ")
blRet = ConvertReportToPDF("CotacoesRelatorio", vbNullString, "C:\Cotacoes" & "Kap_Orçamento_Nº_" & NDaCotacao & "_" & Trim(A1_NREDUZ) & "_Data_" & Format(Data, "dd_mm_yy") & ".PDF", False, True)
Dim objOut As Object
Dim objMail As Object
Dim HTM As String
Dim HTMLBody
objMail.attachments.Add "C:\Cotacoes\Kap_Orçamento_Nº_" & Trim(Me.NDaCotacao) & "_" & Trim(Me.A1_NREDUZ) & "_Data_" & Format(Data(), "dd_mm_yy") & ".PDF"
HTM = ""
Set objOut = CreateObject("Outlook.application")
Dim oOutLook As Object
On Error Resume Next
Set oOutLook = GetObject(, "Outlook.Application") 'Bind to existing instance
Set objMail = objOut.CreateItem(0)
objMail.TO = Me.Email
objMail.Subject = "KAP Componentes Elétricos LTDA - Orçamento: " & "Nº_" & Trim(Me.NDaCotacao)
HTM = HTM & "<font size='3' face='Tahoma'>" & Hora & " " & ContatoCli & ", como vai?" & "<br>"
HTM = HTM & "Em anexo o seu orçamento." & "<br><br>"
assinatura = pega_assinatura("C:\Documents and Settings" & _
Environ("username") & "\AppData\Roaming\Microsoft\Assinaturas" & UsuarioRede & ".htm")
HTM = HTM & assinatura
HTM = HTM & "</font>"
objMail.HTMLBody = HTM
objMail.Display
objMail.attachments.Add "C:\Cotacoes\Kap_Orçamento_Nº_" & Trim(Me.NDaCotacao) & "_" & Trim(Me.A1_NREDUZ) & "_DATA_" & Format(Data)
Set objMail = Nothing
Set objOut = Nothing
End Sub
Private Sub VisualizarEmPDF_Click()
Dim assinatura As Variant
Dim blRet As Boolean
Dim SqlF As String
Dim cr As Recordset
Dim reduz, Email,
SqlF = "SELECT SA1.A1_COD, SA1. A1_NREDUZ “
SqlF = SqlF & " SA1.A1_EMLCOM “
SqlF = SqlF & " FROM SA1"
SqlF = SqlF & " WHERE (SA1.A1_COD)=" & "'" & [Forms]![CotacoesCC_TI].[Cliente] & "'"
Set cr = CurrentDb.OpenRecordset(SqlF)
reduz = cr("A1_NREDUZ")
blRet = ConvertReportToPDF("CotacoesRelatorio", vbNullString, "C:\Cotacoes" & "Kap_Orçamento_Nº_" & NDaCotacao & "_" & Trim(A1_NREDUZ) & "_Data_" & Format(Data, "dd_mm_yy") & ".PDF", False, True)
Dim objOut As Object
Dim objMail As Object
Dim HTM As String
Dim HTMLBody
objMail.attachments.Add "C:\Cotacoes\Kap_Orçamento_Nº_" & Trim(Me.NDaCotacao) & "_" & Trim(Me.A1_NREDUZ) & "_Data_" & Format(Data(), "dd_mm_yy") & ".PDF"
HTM = ""
Set objOut = CreateObject("Outlook.application")
Dim oOutLook As Object
On Error Resume Next
Set oOutLook = GetObject(, "Outlook.Application") 'Bind to existing instance
Set objMail = objOut.CreateItem(0)
objMail.TO = Me.Email
objMail.Subject = "KAP Componentes Elétricos LTDA - Orçamento: " & "Nº_" & Trim(Me.NDaCotacao)
HTM = HTM & "<font size='3' face='Tahoma'>" & Hora & " " & ContatoCli & ", como vai?" & "<br>"
HTM = HTM & "Em anexo o seu orçamento." & "<br><br>"
assinatura = pega_assinatura("C:\Documents and Settings" & _
Environ("username") & "\AppData\Roaming\Microsoft\Assinaturas" & UsuarioRede & ".htm")
HTM = HTM & assinatura
HTM = HTM & "</font>"
objMail.HTMLBody = HTM
objMail.Display
objMail.attachments.Add "C:\Cotacoes\Kap_Orçamento_Nº_" & Trim(Me.NDaCotacao) & "_" & Trim(Me.A1_NREDUZ) & "_DATA_" & Format(Data)
Set objMail = Nothing
Set objOut = Nothing
End Sub
To copy to clipboard, switch view to plain text mode
Bookmarks