Wrox Programmer Forums
BOOK: Professional Outlook 2007 Programming ISBN: 978-0-470-04994-5
This is the forum to discuss the Wrox book Professional Outlook 2007 Programming by Ken Slovak; ISBN: 9780470049945
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Outlook 2007 Programming ISBN: 978-0-470-04994-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 21st, 2011, 02:10 PM
Registered User
Join Date: Jan 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ontime Method in Outlook


I have been trying to use the ontime method in outlook and keep getting error 438, Object does not support this property or method. I coppied the code into excel and it works fine. Does anyone know why it would work in excel but not in Outlook?

 'Code placed in UserForm:
Sub TryThis()
    Application.OnTime Now + TimeValue("00:00:15"), "SayHello"
End Sub

'Code placed in Module:
Public Sub SayHello()
    MsgBox "Hello!"
End Sub
Old September 13th, 2011, 12:13 PM
JP JP is offline
Authorized User
Join Date: Apr 2008
Posts: 57
Thanks: 1
Thanked 3 Times in 3 Posts

I know this post is old, but I thought I'd answer anyway. Outlook does not have an OnTime method, but Excel does. That is why it works in Excel but not Outlook.

To simulate the OnTime Method, create a task with a reminder for the time you want the macro to run. Use a unique Subject string for the task. Hook the BeforeReminderShow Event and check for the unique string in the Subject that you specified when you created the task. If it's a match, run the macro you wanted to run at that time. Also, set Cancel = True so the reminder doesn't actually fire (it already did it's job so it doesn't need to actually fire).
JP SoftTech

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook VBA Beginner Q, Outlook get email address from Excel file summerlight BOOK: Professional Outlook 2007 Programming ISBN: 978-0-470-04994-5 0 December 28th, 2010 06:22 AM
Outlook jdhock8865 Beginning VB 6 3 July 9th, 2008 12:01 PM
Outlook magicroy Excel VBA 0 July 25th, 2007 09:56 AM
Outlook Help ksrmramu Classic ASP Components 0 August 22nd, 2005 07:28 AM
Outlook dinkelfwat Pro VB 6 0 August 20th, 2003 08:19 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.