[OT] Using VBscript to send an email via outlook

Terry Judd terry.judd at unimelb.edu.au
Sun Dec 16 14:18:21 EST 2012


Hi all - I want (if possible) to use a VBscript to format and send emails from Livecode via Outlook on Windows ( I need to do it this way so that I can take advantage of Outlook's DeferredDeliveryTime feature).

Now, I know little or nothing about VBscript but the following routine (courtesy of a Google search) runs fine as a macro within Excel. If however I try to run it from Livecode (do [code] as "VBscript") it returns 'execution error' in the result. Does anyone know enough VBscript to tell me what I'm missing?

Regards,

Terry...

Sub SendMail()
Dim OutApp As Object
Dim Outmail As Object
Dim strBody As String
Set OutApp = CreateObject("Outlook.Application")
OutApp.session.logon
Set Outmail = OutApp.CreateItem(0)
strBody = "This is a test"
On Error Resume Next
With Outmail
    .To = "tsj at unimelb.edu.au<mailto:tsj at unimelb.edu.au>"
    .CC = ""
    .BCC = ""
    .Subject = "Test email"
    .Body = strBody
    .DeferredDeliveryTime = "16/12/2012 16:00:00" 'dd/mm/yyyy hh:mm:ss'
    .Send
End With
On Error GoTo 0
Set Outmail = Nothing
Set OutApp = Nothing
End Sub


Dr Terry Judd
Senior Lecturer in Medical Education
Medical Eduction Unit
Faculty of Medicine, Dentistry & Health Sciences
The University of Melbourne






More information about the use-livecode mailing list