Hi there, I am really new, and already hopeless
Can anybody please tell me, why my code is pasting correctly the image from clipboard into e-mail body?
I am trying to code by myself, sometimes I win, sometime I don't
I would highly appreciate if anybody could teach me where my logic gone wrong.
Sub OpenNewEmailInNotes()
Dim NotesApp As Object
Dim NotesUIWorkspace As Object
Dim NotesUIDoc As Object
Dim rng As Range
Dim emailBody As String
Set NotesApp = CreateObject("Notes.NotesSession")
Set NotesUIWorkspace = CreateObject("Notes.NotesUIWorkspace")
Set NotesUIDoc = NotesUIWorkspace.ComposeDocument("", "", "Memo")
NotesUIDoc.FieldSetText "EnterSendTo", "Email"
NotesUIDoc.FieldSetText "Subject", "Mreport"
Set rng = ThisWorkbook.ActiveSheet.Range("A1:H20")
ThisWorkbook.Activate
rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture
emailBody = "Report attached" & vbCrLf & "<br><br><img src='cid:clipboard_image'>"
NotesUIDoc.FieldAppendText "Body", emailBody
NotesUIDoc.Paste
Set NotesUIDoc = Nothing
Set NotesUIWorkspace = Nothing
Set NotesApp = Nothing
End Sub
Thank you in advance!
ben
Can anybody please tell me, why my code is pasting correctly the image from clipboard into e-mail body?
I am trying to code by myself, sometimes I win, sometime I don't
I would highly appreciate if anybody could teach me where my logic gone wrong.
Sub OpenNewEmailInNotes()
Dim NotesApp As Object
Dim NotesUIWorkspace As Object
Dim NotesUIDoc As Object
Dim rng As Range
Dim emailBody As String
Set NotesApp = CreateObject("Notes.NotesSession")
Set NotesUIWorkspace = CreateObject("Notes.NotesUIWorkspace")
Set NotesUIDoc = NotesUIWorkspace.ComposeDocument("", "", "Memo")
NotesUIDoc.FieldSetText "EnterSendTo", "Email"
NotesUIDoc.FieldSetText "Subject", "Mreport"
Set rng = ThisWorkbook.ActiveSheet.Range("A1:H20")
ThisWorkbook.Activate
rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture
emailBody = "Report attached" & vbCrLf & "<br><br><img src='cid:clipboard_image'>"
NotesUIDoc.FieldAppendText "Body", emailBody
NotesUIDoc.Paste
Set NotesUIDoc = Nothing
Set NotesUIWorkspace = Nothing
Set NotesApp = Nothing
End Sub
Thank you in advance!
ben