2 Replies Latest reply: Aug 4, 2016 5:13 PM by Henrique Demarco RSS

    VB Macro to create e-mail from HTML file

    Henrique Demarco

      Dear helpers,

      I have a macro to create e-mail and send few charts to company stakeholders. My intention is to use HTML file emailrep.html as a default for body. This HTML file has more than 400 lines, so it is hard to convert it to a string using "& _" in the end of each line.

      Pasting HTML code into Qlikview macro creates syntax error.

       

      Set MyOlApp = CreateObject("Outlook.Application")
      Set myItem = MyOlApp.CreateItem(olMailItem)
      
      htmlfile = "Qlikview\emailrep.html"
      
      With myItem
          .To = Email.Item(i).Text
          .BodyFormat = 2
          .Subject = "Sales Report - " & Field.Item(i).Text
          .HTMLBody = htmlfile
          .Attachments.Add ("Report.pdf")
          .Display
      End With
      

       

      Does anyone know how to get HTML file and use as e-mail body with this circumstances?

      The use of Outlook is not mandatory. Just developed because it is easier for me.