Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sarkate_shruti
Partner - Contributor
Partner - Contributor

How to use macro in Gmail for Image.jpg in qlikview

Hello All,

 

I want to use macro in Gmail for Image.jpg in qlikview

In below code mail gets triggered But  Image is not coming  .

 

Kinldy help.

 


'---------------------------------------------------------------START--------------------------------------------------------------------

function SendMail()

Dim objEmail

dim appname2

Const cdoSendUsingPort = 2

Const cdoAnonymous = 0

Const cdoBasic = 1

Const cdoNTLM = 2

Set SMTP = ActiveDocument.GetVariable("SMTPServer")

' Set SMTPData = SMTP.GetContent

ActiveDocument.GetApplication.WaitForIdle

' SMTPServer = SMTPData.String

'; userName = "xxx@xxx.co.za"

' userPassword = "password"

Const SMTPPort = 587 ' Port number for SMTP

Const SMTPTimeout = 60 ' Timeout for SMTP in seconds

'Sending mail

Set objEmail = CreateObject("CDO.Message")

Set objConf = objEmail.Configuration

Set objFlds = objConf.Fields

With objFlds

'---------------------------------------------------------------------

' SMTP server details

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "10.3.11.71"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = "587"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = false

.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

.Update

objEmail.HTMLBODY = "E:\Qlik2Finance\Extraction\Cosumer_Loan\Dashboard\EXPORT\Paper_Mandate_Registration_TAT%.jpg"
'objEmail.AddAttachment "E:\Qlik2Finance\Extraction\Cosumer_Loan\Dashboard\EXPORT\Paper_Mandate_Registration_TAT%.jpg"
'objEmail = E:\Qlik2Finance\Extraction\Cosumer_Loan\Dashboard\EXPORT\Paper_Mandate_Registration_TAT%.jpg' align=baseline border=0> & _

'----'objEmail.HTMLBODY = <img "E:\Qlik2Finance\Extraction\Cosumer_Loan\Dashboard\EXPORT\Paper_Mandate_Registration_TAT%.jpg"

'---------------------------------------------------------------------
'objEmail.HTMLBODY = "E:\Qlik2Finance\Extraction\Cosumer_Loan\Dashboard\EXPORT\Paper_Mandate_Registration_TAT%.jpg"

'att1 = new-object Net.Mail.Attachment("E:\Qlik2Finance\Extraction\Cosumer_Loan\Dashboard\EXPORT\Paper_Mandate_Registration_TAT%.jpg")

End With

'=======================================
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open ("E:\Qlik2Finance\Extraction\Cosumer_Loan\Dashboard\EXPORT\CE.xls")

dim Row_Count1
dim Column_Count1

Set ObjExcelSheet1 = objWorkbook.Sheets("Sheet1")

Row_Count1 = ObjExcelSheet1.UsedRange.Rows.Count
Column_Count1 = ObjExcelSheet1.UsedRange.Columns.Count

cv_GU=cv_GU & "<FONT FACE=""Tahoma"" >"
cv_GU=cv_GU & "<Br><table width=""900"" cellspacing=""0"" border=""1""> "
' cv_GU=cv_GU &" <tr><td colspan=""9"" align=""center"" bgcolor=""#EBF506""><b> DEBTOR PROJECTION STATEWISE<font color=""red"">"'&"</font></b> </td><td colspan=""5"" align=""center"" bgcolor=""#EBF506""><b> DEBTOR EXPOSURE (# of Customers)<font color=""red"">"&"</font></b> </td></tr> " 'MONTH_OPTM
' cv_GU=cv_GU & "<tr><td colspan=""12"" align=""center"" bgcolor=""#EBF506""><b> SANCTIONED <font color=""red"">"&"</font></b> </td></tr> "
' cv_GU=cv_GU & "<tr><td colspan=""3"" align=""center"" bgcolor=""#EBF506""><b> SANCTIONED <font color=""red"">"&"</font></b> </td><td colspan=""7"" align=""center"" bgcolor=""#EBF506""><b> Hunter <font color=""red"">"&"</font></b> </td><td colspan=""7"" align=""center"" bgcolor=""#EBF506""><b> Sampler <font color=""red"">"&"</font></b> </td></tr>
Dim temp_holder2
for intRow=1 To Row_Count1 step 1

cv_GU=cv_GU & "<TR>"
for intcol=1 To Column_Count1 step 1

if objExcel.Cells( intRow,intcol ).Value = "Total" then
temp_holder2 = intRow
end if


if intCol<>4 then
if intRow < 2 then

cv_GU = cv_GU & "<Td align=""center"" bgcolor=""#aed6f1"" >"&objExcel.Cells( intRow,intcol ).Value&"</Td>"
'

else if intRow = temp_holder2 then
IF intCol <> 4 then
cv_GU = cv_GU & "<Td align=""center"" bgcolor=""#CCD1D1"" > <b>"&objExcel.Cells( intRow,intcol ).Value&"</b></Td>"
else if intCol > 14 then

cv_GU = cv_GU & "<Td align=""center"" bgcolor=""#CCD1D1""> <b>"&FormatNumber(objExcel.Cells( intRow,intcol ).Value,0)&"</b></Td>"
' else
' cv_GU = cv_GU & "<Td align=""center"" bgcolor=""#CCD1D1""> <b>"&FormatNumber(objExcel.Cells( intRow,intcol ).Value,0)&"</b></Td>"
end if
end if


else
IF intCol <> 4 then
cv_GU = cv_GU & "<Td align=""center"" > <b>"&objExcel.Cells( intRow,intcol ).Value&"</b></Td>"
else if intCol > 14 then

cv_GU = cv_GU & "<Td align=""center"" > "&FormatNumber(objExcel.Cells( intRow,intcol ).Value,0)&"</Td>"
' else
' cv_GU = cv_GU & "<Td align=""center"" > "&FormatNumber(objExcel.Cells( intRow,intcol ).Value,0)&"</Td>"
end if
end if
end if
end if
end if
next

cv_GU=cv_GU & "</TR>"
next


cv_GU= cv_GU & "</table> </font>"

objExcel.Quit



' =============================
' //objEmail.HTMLBODY = "<HTML><BODY><img align=baseline border=0 hspace=0 src='E:\Qlik2Finance\Extraction\Cosumer_Loan\Dashboard\EXPORT\Paper_Mandate_Registration_TAT%.jpeg'</BODY></HTML>"

'objEmail.HTMLBODY = "E:\Qlik2Finance\Extraction\Cosumer_Loan\Dashboard\EXPORT\Paper_Mandate_Registration_TAT%.jpeg"
Set ToEMail = ActiveDocument.Fields("ToEmail").GetPossibleValues
Set CCEMail = ActiveDocument.Fields("CCEmail").GetPossibleValues

objEmail.Configuration.Fields.Update
' appname2 = "E:\Qlik2Finance\Extraction\Cosumer_Loan\Dashboard\EXPORT\Bkt_X.jpeg"

'objEmail.AddAttachment appname2
Dim ToEmailList
Dim CCEmailList
For i = 0 to ToEMail.Count-1
ToEmailList = ToEmailList&ToEMail.item(i).Text&";"
next
For i = 0 to CCEMail.Count-1
CCEmailList = CCEmailList&CCEMail.item(i).Text&";"
next

objEmail.From = "qlikview@teamcomputers.com"

objEmail.BCC= "sbs@teamcomputers.com"
objEmail.Subject ="TEST"
objEmail.HTMLBody = cvdear & cv_GU & cv & cvbottom


objEmail.Send

Set objFlds = Nothing
Set objConf = Nothing
Set objEmail = Nothing

end function


'---------------------------------------------------------------END------------------------------------------------------------------------------------------

 

Thanks in advance

 

 

0 Replies