Consulting

Results 1 to 5 of 5

Thread: outlook - sending e-mail at a certain time

  1. #1

    outlook - sending e-mail at a certain time

    Hi

    Can anybody help me?

    I need to get outlook to check if its received certain messages at a certain
    time and then e-mail the people whe havn't sent in their messages
    to remind them.

    I can just about cope with the programming for the checking and sending part
    but how do I get the macro to run at a certain time?

    Any help much appreciated

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Hi,
    just some vague thoughts on this I'm afraid...
    You'll need an event that fires at a certain time to trigger the macro and a reminder of some kind would do it. I'm not sure how to set a reference to a reminder object or how you could use it to trigger your code - I'll have a look at that tomorrow.

    But is it not enough to set the emails you send out with message flags set with your deadline?
    K :-)

  3. #3
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    OK, I've had a look at this now. There is an application event for reminders which I just used by adding a new task with the subject: "TEST" and setting a reminder.

    In the VBE, select 'Application' in the object dropdown and 'Reminder' from the events and add this code
    [VBA]Private Sub Application_Reminder(ByVal Item As Object)

    If Item.Subject = "TEST" Then MsgBox "The Application_Reminder event just fired."

    End Sub
    [/VBA]
    This worked nicely, so you'll be able to set a recurring task that fires you code at a regular time each day/week/month or have the option of setting one up whenever you like - any reminder will fire the code if it's item's subject value matches

    Enjoy :-)
    K :-)

  4. #4
    Many thanks

    That bit works fine.

    But how do you get past the Outlook security message alerting you that VBA is trying to send a message. You have to press yes to get it to send the message, but I want it all to work automatically

  5. #5
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Good question... I can't get that message to show up by using code to send a mail item and I can't see where it's set in the options or object model.
    I think this is something to do with the Object Model Guard implemented in Outlook 2002 and enhanced in 2003 which is designed to prevent malicious code hijacking Outlook and writing and sending emails.
    It should not be coming up for local VBA code from the ThisOutlookSession module provided all your objects (specifically your MailItem) have been derived from the Application object so you may want to check all your object references comply with this.

    Other than that, you may find more info at this very useful site:
    http://www.outlookcode.com/

    Have a good weekend
    K :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •