请问我如何在outlook中捕捉新邮件到达、任务启动提醒等事件,请告知,谢谢!!!

 

Application_Reminder(ByVal Item As Object)
详见微软开发技术竞赛第一期答案

回复:

感谢您使用微软的产品。
 
在Outlook中实现这些功能需要借助VBA提供的支持。
 
首先,您打开Visual Basic Editor。

然后在View菜单里选择打开Object Browser窗口。在这里面您可以看到您可以调用的各种Objects以及相应的成员方法等。

您可以选择您所要用的对象的方法,然后用鼠标选中,通过按F1启动Microsoft Visual Basic Help获得更为详尽的帮助。   

例如,您可以通过上述方法找到下面的程序实例来实现捕获新邮件到达事件的功能。
'This example displays the Inbox folder when new mail arrives. 
'The sample code must be ‘placed in a class module, and 
'the Initialize_handler routine must be called before 
'the event procedure can be called by Microsoft Outlook.

Dim WithEvents myOlApp As Outlook.Application

Sub Initialize_handler()
  Set myOlApp = CreateObject("Outlook.application")
End Sub

Private Sub myOlApp_NewMail()
  Dim myExplorers As Outlook.Explorers
  Dim myFolder As Outlook.MAPIFolder
  Set myExplorers = myOlApp.Explorers
  Set myFolder = myOlApp.GetNamespace("MAPI").GetDefaultFolder    (olFolderInbox)
  If myExplorers.Count <> 0 Then
     For x = 1 To myExplorers.Count
       On Error GoTo skipif
         If myExplorers.Item(x).CurrentFolder.Name = "Inbox" Then
            myExplorers.Item(x).Display
            myExplorers.Item(x).Activate
            Exit Sub
         End If
skipif:
     Next x
  End If
  On Error GoTo 0
  myFolder.Display
End Sub

同样您也可以用同样的方法来看看如何使用Reminder方法。
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值