【问题标题】:get outlook to fire vba script on old emails让 Outlook 在旧电子邮件上触发 vba 脚本
【发布时间】:2014-09-05 06:53:15
【问题描述】:

我在 Outlook 中编写了一些 vba,当收到新电子邮件时会触发它。但是我想在旧电子邮件上触发它以进行测试。谁能告诉我怎么做。

我当前的代码是

Private Sub objInbox_ItemAdd(ByVal Item As Object)

谢谢

【问题讨论】:

    标签: vba outlook outlook-2007


    【解决方案1】:

    我已经整理好了,谢谢。

    Private Sub Application_Startup()
       Set objInbox = Session.GetDefaultFolder(olFolderInbox).Items
    'Call test
       'MsgBox "outlook starting"
    End Sub
    Sub test()
        MsgBox "in test"
        Dim ns As NameSpace
        Dim item As Object
        Dim inbox As MAPIFolder
         'Dim sub_folder As MAPIFolder
    
        Set ns = GetNamespace("MAPI")
        Set inbox = ns.GetDefaultFolder(olFolderInbox)
         'Set sub_folder = inbox.Folders("TEST")
    
        For Each item In inbox.Items
        If TypeOf item Is MailItem Then
            MsgBox "right subject"
        End If
        Next item
    End Sub
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-03
      • 1970-01-01
      • 1970-01-01
      • 2011-09-28
      • 2022-01-19
      • 1970-01-01
      • 1970-01-01
      • 2014-05-01
      相关资源
      最近更新 更多