Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Paula1
Creator
Creator

I need to place the objEmail.AddAttachment variable correctly.

vApêndice 1: Vendas
Gostaria de corrigir esta parte do código
objEmail.AddAttachment "C:\General\tmp\&vName1&.pdf"
O nome está saindo "C:\General\tmp\&vName1&.pdf
'vNome = GetVariable("vAnexo1")'
Preciso que o nome seja C:\Geral\tmp\ Vendas2.pdf
 
Qualquer dica, segue uma planilha excel com as variáveis, qvw,
Alguém pode me ajudar.
obrigado.
 
2023-11-04_11-00-55.jpg
subPrintReport
Definir WSHShell = CreateObject("WScript.Shell")
fln = "C:\Geral\tmp\meureport.pdf"
RegKey = "HKEY_CURRENT_USER\Software\QlikViewPDF\"
WSHShell.RegWrite RegKey & "BypassSaveAs", 1
WSHShell.RegWrite RegKey & "OutputFile", fln
ActiveDocument.GetApplication.Sleep 2000
WSHShell.RegWrite RegKey & "BypassSaveAs", 0
WSHShell.RegWrite RegKey & "OutputFile", ""
Definir WSHShell = nada
 
 
final sub
 
função GetVariable(varNome)
        Escurecer v
        definir v = ActiveDocument.Variables(varName)
        GetVariable = v.GetContent.String
função final
 
SubexecutorMacro()
       ActiveDocument.Recarregar        
        Envio()
        ActiveDocument.Save
       'ActiveDocument.GetApplication.Quit
       ' ActiveDocument.GetApplication.Close        
Finalizar sub
 
Subenvio()
'Set TabelaEmails = ActiveDocument.Fields("Gerente").GetPossibleValues(1000)
'For contEmail = 0 to TabelaEmails.Count - 1 ' Aqui faz um Laco com o campo "Gerente"......
'ActiveDocument.Fields("Gerente").Seleção TabelaEmails.Item(contEmail).Text
        '============================================== = =======================================
        'Aqui apaga se tiver os arquivos.....
        Definir arquivosys = CreateObject("Scripting.FileSystemObject")
Se filesys.FileExists("C:\Geral\tmp\&vName1&.pdf") então
filesys.DeleteFile "C:\Geral\tmp\&vNome1&.pdf"
Fim se
 
 
        '================================================ =========================================
        ' Aqui roda o relatorio ID RP01
ActiveDocument.GetApplication.Sleep 2000
Definir filesys = Nada
        ActiveDocument.PrintDocReport "RP01", "RP01"   
Relatório de impressão()
ActiveDocument.GetApplication.Sleep 5000
'Aqui se existe o PDF, então renomeia ele.......
        Definir arquivosys = CreateObject("Scripting.FileSystemObject")
Se filesys.FileExists("C:\Geral\tmp\QlikView Printing.pdf") então
   filesys.MoveFile "C:\Geral\tmp\QlikView Printing.pdf","C:\Geral\tmp\&vName1&.pdf"
Fim se
Definir filesys = Nada
ActiveDocument.GetApplication.Sleep 5000
 
' ' Início das configurações do EMAIL
' Início das configurações do EMAIL
  ServidorSMTP = "mail.x.com.br"
UsuárioSMTP = "x"
SMTPpPWD = "x***"
SMTPPorta = "465"
Definir objEmail = CreateObject("CDO.Message")
Definir objConf = objEmail.Configuration
Definir objFlds = objConf.Fields
Com objFlds
'---------------------------------------------------------------- --------------------
se len(ServidorSMTP) > 0 então
outro
fim se
.Atualizar
'---------------------------------------------------------------- --------------------
Destinatário = GetVariable("vDestinatário")
Número = GetVariable("vNúmero")
Espaço = GetVariable("vEspaço")
    Título = GetVariable("vTítulo")
     Assunto = GetVariable("vAssunto")
     FilePath = "C:\Geral\tmp\"
     NomeArquivo = vNome 
     vNome = GetVariable("vAnexo1")
 
Terminar com
objEmail.To = Destinatário
'objEmail.CC = "c"
objEmail.Bcc = "x"
objEmail.From = "x"
objEmail.Subject = Assunto & Anexo1
objEmail.HTMLBody = Número & Espaço & Título  
        '============================================== = ==========
        '============================================== = =======================================
        'Aqui colocamos os anexos.....
        
objEmail.AddAttachment "C:\Geral\tmp\&vNome1&.pdf"
'
' '============================================= = =========================================
objEmail.Enviar
        '============================================== = =======================================
        'Aqui apagamos os arquivos pois sessão da erro na próxima vez.....
'ActiveDocument.Save
ActiveDocument.GetApplication.Sleep 5000
       
'Próximo
'ActiveDocument.Fields("Gerente").Clear ' Limpar Filtro por Email
 
 
Finalizar sub
 
 
Paula Santos
vitória - ES
Labels (3)
0 Replies