zoukankan      html  css  js  c++  java
  • 删除OutLook中的邮件,终于搞定了

    有两种方法
    1。根据主旨删除Email(Subject 为邮件主旨)
    Sub delEmail(Subject  As String)
        Dim myolApp As New Outlook.Application
        Dim myOlExp As Outlook.Explorer
        Set myOlExp = myolApp.ActiveExplorer
        'MsgBox myOlExp.CurrentFolder.Name
        Dim objMessages As Outlook.Items
        Dim objMessage As Outlook.MailItem
        Set objMessages = myOlExp.CurrentFolder.Items
        Set objMessage = objMessages.Find("[Subject] = """ & Subject & """")
        If objMessage Is Nothing Then
                'MsgBox "Not Found"
        End If
        Do While Not objMessage Is Nothing
            'objMessage.Close
            objMessage.Delete
            Set objMessage = objMessages.FindNext
        Loop
        Set objMessage = Nothing
        Set objMessages = Nothing
        Set myOlExp = Nothing
        Set myolApp = Nothing
    End Sub


    2删除当前打开的Email
    Sub delOpenEmail()
        Set myolApp = CreateObject("Outlook.Application")
        On Error Resume Next
        Set myItem = myolApp.ActiveInspector.CurrentItem
        myItem.Delete
    End Sub
  • 相关阅读:
    Python-产生随机长度的密码
    Python-双色球
    Python-产生手机号码
    Word操作笔记
    1035 最长的循环节
    B. Recover the String
    uva11752 The Super Powers
    UVA11754
    GCD
    D. Persistent Bookcase(Codeforces Round #368 (Div. 2))
  • 原文地址:https://www.cnblogs.com/Sunny/p/2210.html
Copyright © 2011-2022 走看看