4 Replies Latest reply: Jun 13, 2017 6:32 AM by Ankit N RSS

    Chart in e-mail body

    Paul Wonford

      Hi guys, i have a small piece of code


      Sub Email_Test()


      EmailBody = "HI"


      Subject = "test"


      Set vOlApp = CreateObject("Outlook.Application")

      Set vMessage = vOlApp.CreateItem(olMailItem)

      vMessage.Subject = Subject

      vMessage.To = Email_Recipient

      vMessage.HTMLBody = EmailBody



      End Sub

      If i have a chart (CH11) - can someone tell me how to drop the chart into the body of the e-mail? I can use HTML to create a link to a file but i need to copy and paste the chart into the actual body of the message. Can anyone help?

        • Re: Chart in e-mail body
          Frank Hartmann

          try like this:

          Sub Export2Mail
          Set myApp = CreateObject ("Outlook.Application")
          Set myMessage = myApp.CreateItem(olMailItem)
          myMessage.BodyFormat = 2 'HTMLFormat
          myMessage.To = "Name@Provider.com"
          myMessage.Subject = "Qlikview Email "
          myMessage.Attachments.Add("C:\Users\Admin\Desktop\MAKRO.txt")      'If you want to add a file
          Set myInspector = myMessage.GetInspector 'add signature to e-mail
          Set myDoc = myInspector.WordEditor
          ActiveDocument.GetSheetObject("CH01").CopyBitmapToClipboard        ' adapt your Chart ID here
          myDoc.Range(0,0).PasteSpecial False, False, 0, False, 5
          myInspector.WordEditor.Content.InsertBefore chr(13)
          myInspector.WordEditor.Content.InsertBefore chr(13)
          myInspector.WordEditor.Content.InsertBefore "Hello, " & chr(13) & chr(13) & "Your Message here"
          Set myMessage = Nothing
          Set myApp = Nothing
          Set myInspector = Nothing
          Set myDoc = Nothing
          End sub



          hope this helps!

          • Re: Chart in e-mail body
            Frank Hartmann

            Make sure that you have following settings in module activated:




            hope this helps