Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey all,
I need your help in Macro issue.
I need an e-mail with a QV document certain objects to be sent daily.
I understand it's possible to write Marco that does it, but the only option with examples I've found meanwhile is creating a button that runs Macro. This is not a good solution in my case, cause I need the e-mail to be sent every day automatically (by schedule), without waiting that someone will press the button to send an e-mail...
Is there an outside-of-Qliqview option to write a VB script for sending e-mails?
If there is, please give me some examples to implement this (I have no idea of writing Macros..)
Thank you!
Hi Linoy
One Solution could be create a qvw that have the macro to send the email, and then create a windows task that call this qvw and execute the macro.
the task would be automatic and you can set the hour and others configurations.
Tell me if you need something
Good luck
Fernando
Hi Linoy
Please find the attached word file and follow the mention steps in word you can achieve your goal.
Thank you for your help!
All answers were great and helped me a lot in understanding the subject.
I also found a nice explanation how to activate Macro code using triggers (instead of a button):
Hi Fernando!
Thanks - that seems to be a great solution for me and I'll certainly try it.
Although, is it possible to write a Macro in one qvw that emails objects from another qvw?
What's the code for it?
Sub Dagrapport
vReport = “QVreportname” ‘Set report
vName = “reportname” ‘Name of output pdf
reportFile = “reportpath” & vName &”.pdf” ‘Setting outputname
MyPrintPDFWithBullZip(reportFile) ‘Call pdf printer
zendDagrapport
End sub
FUNCTION MyPrintPDFWithBullZip (pdfOutputFile)
set obj = CreateObject(“Bullzip.PDFPrinterSettings”)
END FUNCTION
‘===========================================================================
‘===========================================================================
function zendDagrapport()
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
SMTPServer = “IP Mailserver”
Const SMTPPort = 25 ‘ 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”) = 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
end function
Linoy
You would export the object before?
You could export before the object or you could replicate the objects and put in the new qvw.
could be a copy of the first qvw that only the diferences is that have this macro send email pherhaps
The original qvw runs every hour (and it's very heavy, it runs for 25 mins) but I need to send a certain object from it only once a day (this specific object changes once a day as well).
Ok, perfect
You could export the objects to some local folder and then the new qwv wiit the macro will import and attached in the email
your macro will attach them
i send you the macro to send email with object attached