Outlook - GetCurrent Folder / GetSelectedItems / GetInspectors

不打扰是莪最后的温柔 提交于 2020-03-04 20:22:43
http://msdn.microsoft.com/library/en-us/vbaol10/html/olobjdistlistitem.asp
http://msdn.microsoft.com/library/en-us/vbaol10/html/olobjInspectors.asp

Sub GetCurrentFolder()
  Dim myolApp As New Outlook.Application
  Dim myOlExp As Outlook.Explorer
  Set myOlExp = myolApp.ActiveExplorer
  MsgBox myOlExp.CurrentFolder.Name
End Sub


Sub GetSelectedItems()
    Dim myolApp As New Outlook.Application
    Dim myOlExp As Outlook.Explorer
    Dim myOlSel As Outlook.Selection
    Dim MsgTxt As String
    Dim x As Integer
    MsgTxt = "You have selected items from: "
    Set myOlExp = myolApp.ActiveExplorer
    Set myOlSel = myOlExp.Selection
    For x = 1 To myOlSel.Count
        MsgTxt = MsgTxt & myOlSel.Item(x).SenderName & ";"
    Next x
    MsgBox MsgTxt
End Sub

Sub GetInspectors()
    Dim myolApp As New Outlook.Application
    If myolApp.Inspectors.Count > 0 Then
        For x = 1 To myolApp.Inspectors.Count
            Set myItem = Inspectors.Item(x)
            MsgBox myItem.Cation
        Next x
    Else
        MsgBox "There are no inspector windows open."
    End If
End Sub
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!