开发者

How to add MS outlook reminders event handlers with VBA

开发者 https://www.devze.com 2023-03-28 12:12 出处:网络
I want to extend MS Outlook so that when a calendar reminder pops up, I can run a VBA hook that can run an external program (like a batch script). In my case, I want to \"forward\" the reminder to a L

I want to extend MS Outlook so that when a calendar reminder pops up, I can run a VBA hook that can run an external program (like a batch script). In my case, I want to "forward" the reminder to a Linux desktop since I work in both environments and I don't always have the Windows desktop visible.

I see an example at http://office.microsoft.com/en-us/outlook-help/HV080803406.aspx and have opened VBA Developer view in MS outlook 2010 and inserted a class module and added that VBA code, but I do not see how to activate this code - when a reminder pops up, this code is not activated.

Update

Here is what I ended up adding to Outlook's ThisOutlookSession to run an external batch script when a 开发者_如何学编程reminder pops up.

Public WithEvents objReminders As Outlook.Reminders

Private Sub Application_Startup()
    Set objReminders = Application.Reminders
End Sub

Private Sub objReminders_ReminderFire(ByVal ReminderObject As Reminder)
    Cmd = "C:\path\to\my\reminder-hook.cmd" & " " & ReminderObject.Caption
    Call Shell(Cmd, vbHide)
End Sub


Put it in the "ThisOutlookSession" module and restart Outlook.

Also, ensure that macros are enabled in Outlook settings.

0

精彩评论

暂无评论...
验证码 换一张
取 消