[OT] Using VBscript to send an email via outlook

Kennan Ray kray at sonsothunder.com
Sun Dec 16 15:32:33 EST 2012


Terry, I wouldn't use script that works inside a Microsoft app because that's likely to be *VBA* (VB for Applications) and not *VBS* (VB Script) and they have some differences. try looking for raw VBS examples. I'm not at my desk or I'd give you some code, but hopefully this will point you in the right direction.

Ken Ray
Sons of Thunder Software, Inc.

On Dec 16, 2012, at 1:18 PM, Terry Judd <terry.judd at unimelb.edu.au> wrote:

> 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
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list