Notifications
Clear all

Copiar Range e colar como imagem no Lotus Notes

3 Posts
2 Usuários
0 Reactions
1,435 Visualizações
(@ana-carolina-toledo)
Posts: 11
Active Member
Topic starter
 

Boa noite queridos,

Tenho código para envio de e-mail através do Lotus Notes porém não consigo copiar um range e colar no body do e-mail como imagem.

Alguém saberia fazer?

Obrigada!

Dim Subject, BodyText, SendTo, Cc, Bcc As String
Dim Attachment, AttachmentType As String

'Set up the objects required for Automation into lotus notes
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'The current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim Session As Object 'The notes session
Dim Body As Object
Dim BodyChild As Object 'Html text & the attachment
Dim Header As Object
Dim Stream As Object

Sub SendEmail()

        Subject = "teste"
        BodyText = "teste"
        recep = "teste@mail.com"
        recepcc = "testeCC@mail.com"
        recepbcc = "testeBcc@mail.com"
        Attachment = ActiveWorkbook.FullName
            
        Dim iii As Long, FileName As String, AttachmentTypee, a(1 To 1)
        
        'Initialize
        Set Session = CreateObject("Notes.NotesSession")
        Session.CONVERTMIME = False
        UserName = Session.UserName
        MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
            
        'Open the mail database in notes
        Set Maildb = Session.GETDATABASE("", MailDbName)
        If Not Maildb.IsOpen Then Maildb.OPENMAIL
            
        'Set up the new mail document
        Set MailDoc = Maildb.CREATEDOCUMENT
        MailDoc.Form = "Memo"
        Call MailDoc.AppendItemValue("SendTo", recep)
        Call MailDoc.AppendItemValue("Copyto", recepcc)
        Call MailDoc.AppendItemValue("BlindCopyTo", recepbcc)
        MailDoc.Subject = Subject
            
        'Set up the body html text
        Set Body = MailDoc.CREATEMIMEENTITY
        Set BodyChild = Body.CREATECHILDENTITY
        Set Stream = Session.CREATESTREAM
        Stream.WriteText BodyText
        BodyChild.SETCONTENTFROMTEXT Stream, "text/html;charset=iso-8859-1", ENC_IDENTITY_8BIT
        Stream.Close
        Stream.TRUNCATE
            
        'Set up the attachments
        If Not IsArray(Attachment) Then If Len(Attachment) Then a(1) = Attachment: Attachment = a
            
        If IsArray(Attachment) Then
            For iii = LBound(Attachment) To UBound(Attachment)
                FileName = Dir(Attachment(iii))
                If Len(FileName) Then
                    Set BodyChild = Body.CREATECHILDENTITY
                    Set Header = BodyChild.CREATEHEADER("Content-Type")
                    Header.SETHEADERVAL "multipart/mixed"
                    Set Header = BodyChild.CREATEHEADER("Content-Disposition")
                    Header.SETHEADERVAL "attachment; filename=" & Chr(34) & FileName & Chr(34)
                    Set Header = BodyChild.CREATEHEADER("Content-ID")
                    Header.SETHEADERVAL FileName
                    Set Stream = Session.CREATESTREAM
                    If Stream.Open(Attachment(iii), "binary") Then
                        AttachmentTypee = Split(Attachment(iii), ".")
                        AttachmentTypee = "application/" & AttachmentTypee(UBound(AttachmentTypee))
                        BodyChild.SETCONTENTFROMBYTES Stream, AttachmentTypee, ENC_IDENTITY_BINARY
                    End If
                End If
            Next iii
        End If
            
        'Send the document
        MailDoc.SaveMessageOnSend = True
        MailDoc.PostedDate = Now()
        Call MailDoc.Send(False)
        
        MsgBox "Email successfully sent", vbInformation
        
ErrHdl:
    If Err.Number Then MsgBox "VBA error: " & Err.Description, vbCritical, "Lotus Notes Email"
        'Clean Up
        On Error Resume Next
        Session.CONVERTMIME = True
        Set Body = Nothing
        Set BodyChild = Nothing
        Set Header = Nothing
        Set Maildb = Nothing
        Set MailDoc = Nothing
        Set Session = Nothing
        Set Stream = Nothing

End Sub
 
Postado : 14/02/2013 6:29 pm
Fernando Fernandes
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Boa noite!!

Use a pesquisa do fórum, pois ja ouve dúvida siimilar!
Leia:
http://www.rondebruin.nl/sendmail.htm
Consegue adaptar?

Dim NUIdoc As Object
    Dim Email ' add new dim
    Set NSession = CreateObject("Notes.NotesSession")
    Set NUIWorkSpace = CreateObject("Notes.NotesUIWorkspace")
    
    Set NDoc = NUIWorkSpace.ComposeDocument("", "", "Memo")
    Set NUIdoc = NUIWorkSpace.CURRENTDOCUMENT
    Email = Worksheet("sheet1").Range("a1").Value 'mudar para a sua referência de células
    With NUIdoc
        .FieldSetText "EnterSendTo", Email  
        .FieldSetText "EnterCopyTo", "cc.email@email.com"

Att

Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel

 
Postado : 14/02/2013 6:33 pm
(@ana-carolina-toledo)
Posts: 11
Active Member
Topic starter
 

Desculpe Alexandre e Obrigaa!!

 
Postado : 14/02/2013 7:26 pm