Advertisement
Guest User

Untitled

a guest
Jun 27th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. Sub DoStuff()
  2. Dim currentChart As ChartObject
  3.  
  4. Dim counter As Integer
  5. counter = 1
  6. For Each currentChart In Sheets("TablesForCharts").ChartObjects
  7. Select Case counter
  8. Case 1
  9. currentChart.Chart.Export "C:\Users\bgyoti01\Desktop\Chart1.png"
  10. Case 2
  11. currentChart.Chart.Export "C:\Users\bgyoti01\Desktop\Chart2.png"
  12. Case 3
  13. currentChart.Chart.Export "C:\Users\bgyoti01\Desktop\Chart3.png"
  14. Case 4
  15. currentChart.Chart.Export "C:\Users\bgyoti01\Desktop\Chart4.png"
  16. End Select
  17. counter = counter + 1
  18. Next currentChart
  19.  
  20. Dim OutApp As Object
  21. Dim OutMail As Object
  22.  
  23. Set OutApp = CreateObject("Outlook.Application")
  24. Set OutMail = OutApp.CreateItem(0)
  25.  
  26. With OutMail
  27. .To = "stefan.yakimov@ingrammicro.com"
  28. .CC = ""
  29. .Attachments.Add "C:\Users\bgyoti01\Desktop\Chart1.png", olByValue, 0
  30. .Attachments.Add "C:\Users\bgyoti01\Desktop\Chart2.png", olByValue, 0
  31. .Attachments.Add "C:\Users\bgyoti01\Desktop\Chart3.png", olByValue, 0
  32. .Attachments.Add "C:\Users\bgyoti01\Desktop\Chart4.png", olByValue, 0
  33. .Subject = "subjecttttttt"
  34. .HTMLBody = .HTMLBody & "<img src='cid:Chart1.png'" & "<img src='cid:Chart2.png'" & "<br></br>" & "<img src='cid:Chart3.png'" & "<img src='cid:Chart4.png'"
  35. .Send
  36. End With
  37.  
  38. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement