SenderName from Outlook macro is blank

后端 未结 2 1826
生来不讨喜
生来不讨喜 2021-01-25 18:33

I want to get the SenderName and and To properties from a MailItem object, but they are coming through as blank.

I can see that th

2条回答
  •  清歌不尽
    2021-01-25 19:04

    Try the following...

    Use the code on regular module

    Option Explicit
    Public Sub Example()
        Dim olMsg As mailitem
    
        Set olMsg = ActiveExplorer.Selection.Item(1)
    
        '// All print on Immediate Window
        Debug.Print olMsg.SenderName
        Debug.Print olMsg.sender
        Debug.Print olMsg.SenderEmailAddress
        Debug.Print olMsg.Categories
        Debug.Print olMsg.subject
        Debug.Print olMsg.To
        Debug.Print olMsg.CC
        Debug.Print olMsg.ReceivedByName
        Debug.Print olMsg.SenderEmailType
    
    End Sub
    

提交回复
热议问题