Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I am able send a report by attaching them but i need to insert report(image) in a body.
plz check this is my macro :
sub ExcelFile
strDate = CDate(Date)
strDay = DatePart("d", strDate)
strMonth = DatePart("m", strDate)
strYear = DatePart("yyyy", strDate)
If strDay < 10 Then
strDay = "0" & strDay
End If
If strMonth < 10 Then
strMonth = "0" & strMonth
GetFormattedDate = strMonth & "-" & strDay & "-" & strYear
Set v = ActiveDocument.Variables ("EmailAddress")
EmailAddress=v.GetContent.String
Set CC = ActiveDocument.Variables ("EmailAddressCC")
EmailAddressCC= CC.GetContent.String
Set From = ActiveDocument.Variables ("EmailAddressFrom")
EmailAddressFrom= From.GetContent.String
'/////////////////////////////////Export To Image//////////////////////////////////
Set Path = ActiveDocument.Variables ("vPath")
vPath= Path.GetContent.String
Set Report = ActiveDocument.Variables ("vReport")
vReport= Report.GetContent.String
set obj = ActiveDocument.GetSheetObject("CH02")
obj.ExportEx "D:\Qlikview\Send Mail with Report\test.jpg",2
'/////////////////////////////////Email//////////////////////////////////
Set objMsg = CreateObject("CDO.Message")
Set msgConf = CreateObject("CDO.Configuration")
' Server Configuration
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxx"
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxx"
msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
msgConf.Fields.Update
' Email
objMsg.To = EmailAddress
objMsg.Cc = EmailAddressCC
objMsg.From = EmailAddressFrom
objMsg.SUBject = "QlikView Automated Report" ' Subject
'objMsg.TextBody = "Qlikview Report"
objMsg.HTMLBODY ="<HTML> <BODY> <img align=baseline border=0 hspace=0 src='D:\Qlikview\Send Mail with Report\test.jpeg'> </BODY> </HTML>"
Set objMsg.Configuration = msgConf
' Send
objMsg.Send
' Clear
Set objMsg = nothing
Set msgConf = nothing
Msgbox " Mail delivered"
END SUB