Ir ao conteúdo
  • Cadastre-se

rizzatto

Membro Júnior
  • Posts

    3
  • Cadastrado em

  • Última visita

Reputação

0
  1. Olá achei um codico VBA, para enviar um email pelo excel com o lotus notes, estou semanas procurado um codico que funcione o corpo de email, achei esse aqui que aparentemente funciona, só que da um erro na linha 7 = Dim Data As DataObject Alguém me ajuda a traduzir aqui também? VBA code: Sub Send_Unformatted_Rangedata() Dim noSession As Object, noDatabase As Object, noDocument As Object Dim vaRecipient As Variant Dim rnBody As Range Dim Data As DataObject Const stSubject As String = "Send only an unformatted range of data." Const stMsg As String = "Data as part of the e-mail's body." Const stPrompt As String = "Please select the range:" 'This is one technique to send an e-mail to many recipients but for larger 'number of recipients it's more convenient to read the recipient-list from 'a range in the workbook. vaRecipient = VBA.Array("[email protected]", "[email protected]") On Error Resume Next Set rnBody = Application.InputBox(Prompt:=stPrompt, _ Default:=Selection.Address, Type:=8) 'The user canceled the operation. If rnBody Is Nothing Then Exit Sub On Error GoTo 0 'Instantiate Lotus Notes COM's objects. Set noSession = CreateObject("Notes.NotesSession") Set noDatabase = noSession.GETDATABASE("", "") 'Make sure Lotus Notes is open and available. If noDatabase.IsOpen = False Then noDatabase.OPENMAIL 'Create the document for the e-mail. Set noDocument = noDatabase.CreateDocument 'Copy the selected range into memory. rnBody.Copy 'Retrieve the data from then copied range. Set Data = New DataObject Data.GetFromClipboard 'Add data to the mainproperties of the e-mail's document. With noDocument .Form = "Memo" .SendTo = vaRecipient .Subject = stSubject 'Retrieve the data from the clipboard. .Body = Data.GetText & " " & stMsg .SaveMessageOnSend = True End With 'Send the e-mail. With noDocument .PostedDate = Now() .Send 0, vaRecipient End With 'Release objects from memory. Set noDocument = Nothing Set noDatabase = Nothing Set noSession = Nothing 'Activate Excel for the user. AppActivate "Microsoft Excel" 'Empty the clipboard. Application.CutCopyMode = False MsgBox "The e-mail has successfully been created and distributed.", vbInformation End Sub
  2. Boa Tarde Galera, Tenho o código a baixo, para enviar um e-mail com Lotus Notes pelo Excel . Entretanto, preciso ajustar ainda: 1 - Quero formatar o corpo do e-mail (Colorir algumas palavras), ou encaminhar o texto copiado do excel como imagem no corpo do e-mail. Sub EnviarEmailViaNotes() Dim notesSession As Object Dim notesMailFile As Object Dim notesDocument As Object Dim notesField As Object Dim receptores(2) As Variant 'Cria Uma lista de destinatários receptores(0) = "[email protected]" receptores(1) = "" 'Abre uma sessão do notes, abre a base de dados e cria um documento. Set notesSession = CreateObject("Notes.NotesSession") Set notesMailFile = notesSession.GetDataBase("", "names.nsf") '- *.nsf = arq. com lista de contatos Set notesDocument = notesMailFile.CreateDocument 'Configura Subject, SendTo e Abre um nomo corpo de e-mail Set notesField = notesDocument.AppendItemValue("Subject", "Teste de Envio via Excel...") Set notesField = notesDocument.AppendItemValue("SendTo", receptores) Set notesField = notesDocument.CreateRichTextItem("Body") 'Escreve o texto padrão no e-mail. With notesField .AddNewLine (1) .AppendText .Range("B3:L25").Select .AddNewLine (2) .AppendText Cells(1, 1).Value 'aqui faz referencia a uma variável ou a uma parte da planilha End With 'Envia o e-mail notesDocument.Send False 'Limpa as variáveis Set notesSession = Nothing Set notesMailFile = Nothing Set notesDocument = Nothing Set notesField = Nothing End Sub

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...