1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Public Sub Send_daily_Message()
Dim ol As Object, myItem As Object
Dim corps_1 As String
Dim corps_2 As String
Set rangebody = ActiveSheet.Range("B2:V38")
rangebody.Copy
Dim p As Picture
Set p = ActiveSheet.Pictures.Paste
p.Cut
Set ol = CreateObject("outlook.application")
Set myItem = ol.CreateItem(olMailItem)
myItem.Display
myItem.To = "badass@yyyy.com"
myItem.Subject = "Daily mail " & Format(Now, "DD/MM/YY")
corps_1 = "Dear All," & Chr(10) & Chr(10) & _
"Please see below the daily details:" & Chr(10) & Chr(10) _
'& "- Results are " & [Results].Value & " // Results last year were: " & [Results_Last_Year].Value & _
" Results evolved by " & [Results_evolution].Value & " and market share evolved by " & [Market_share_evolution].Value
corps_2 = "Please let me know if you have any question." & Chr(10) & Chr(10) _
& "Best regards,"
Dim wEditor As Word.Document
Set wEditor = ol.ActiveInspector.WordEditor
'Paste Picture
wEditor.Range.Paste
myItem.HTMLBody = corps_1 & myItem.HTMLBody & corps_2
myItem.Send
Set ol = Nothing
End Sub |
Partager