Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have attached a sample application.
I need to send mail to the customers with his data on post reload.
It has to select the code by code and need to send the report to him.
I have created the report under report section.
Regards,
Veman
I have not Idea about PDF but we send to report as html format.
i have send to html send mail report code
--------------------------------------------------------------------------------------------
rem ** VBScript **
set test= CreateObject("QlikTech.QlikView")
set ActiveDocument = test.OpenDoc ("Your path\Testsend .qvw","","")
ActiveDocument.Reload
rem newdoc.Reload
Call sendMailFinal()
REM Insert macro code here. Make sure to call any objects using the prefix 'test' since that is the
REM QlikView object.
Rem test.quit
ActiveDocument.Save
ActiveDocument.CloseDoc
function sendMailFinal()
'Export sheet object to XLS and html file
Path = "C:\Documents and Settings\rlimumweb011\Desktop\testMail.xls"
set obj = ActiveDocument.GetSheetObject("CH266")
obj.ExportBiff Path
obj.ExportHtml replace(Path,".xls",".html")
Dim objEmail
Const cdoSendUsingPort = 2 ' Send the message using SMTP
Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM
Const SMTPServer = "10.126.164.76" 'SMTP server IP
Const SMTPPort = 25 ' Port number for SMTP
Const SMTPTimeout = 60 ' Timeout for SMTP in seconds
'Sending mail
Set objEmail = CreateObject("CDO.Message")
set objConf = CreateObject("CDO.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") = SMTPServer
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = SMTPTimeout
.Update
'---------------------------------------------------------------------
End With
'Get object send to xls and attached
With objEmail
Set .Configuration = objConf
.From = "From ID"
.To = "To ID"
.Subject = "Subject of Mail"
.HTMLBody=RenderHtmlFile("C:\Documents and Settings\rlimumweb011\Desktop\testMail.html")
.TextBody = "Dear All," & Chr(13) & "The hourly login figures for respective Channel are:" & Chr(13) & Chr(13) & Chr(13)
'.AddAttachment Path
.Send
End With
Set objFlds = Nothing
Set objConf = Nothing
Set objEmail = Nothing
'msgbox ("Test Mail Sent")
End Function
'This function reads the file as html to display as body
Function RenderHtmlFile(filename)
Dim fsoFile, fsoObject
Dim Texto
Texto = "Dear All," & "<br>" & "The hourly login figures for respective Channel are:"
' Texto ="<html>" & "<body>" & "<h1>" & "Dear All," & "</h1>" & "<p>" & " Hourly login Figures For respective Channles are :" & "</p>" & "</body>" & "</html>"
'Texto ="<html>" & "<body>" & "<p>" & " Dear All," & "<Br/>" & " Hourly login Figures For respective Channles are :" & "</p>" & "</body>" & "</html>"
Set fsoObject = CreateObject("Scripting.FileSystemObject")
Set fsoFile = fsoObject.OpenTextFile(filename)
Do While Not fsoFile.AtEndOfStream
Texto = Texto & fsoFile.ReadLine
Loop
'Texto = Texto & "<html>" & "<body>" & "<br/>" & "<br/>" & "</body>" & "</html>"
RenderHtmlFile = Texto
'msgbox(Texto)
fsoFile.Close
Set fsoArquivo = Nothing
Set fsoObjeto = Nothing
End Functio
------------------------------------------------------------------------------------------------------------------------
Please tiger macro on field selection
Regards
Ashish Srivastava