检索电子邮件 ID 而不是姓名

检索电子邮件 ID 而不是姓名

以下代码从文件中检索所有信息.msg。但是,当它检索发件人和收件人的电子邮件 ID 时,它显示的是姓名而不是电子邮件 ID。请帮助我并建议需要进行哪些更改才能显示电子邮件 ID 而不是姓名。

Dim MyOutlook As Outlook.Application

Dim Msg As Outlook.MailItem
Dim x As Namespace
Dim Row As Integer
Dim Path As String
Set MyOutlook = New Outlook.Application
Set x = MyOutlook.GetNamespace("MAPI")
Path = "C:\Users\USERNAME\Desktop\My working\Macro\New folder\Ilearn - Grp 1\"

FileList = GetFileList(Path + "*.msg")
Row = 1

While Row <= UBound(FileList)

    Set Msg = x.OpenSharedItem(Path + FileList(Row))

    Sheet2.Cells(Row + 1, 1) = Msg.Subject
    Sheet2.Cells(Row + 1, 2) = Msg.Sender
    Sheet2.Cells(Row + 1, 3) = Msg.CC
    Sheet2.Cells(Row + 1, 4) = Msg.To
    Sheet2.Cells(Row + 1, 5) = Msg.SentOn
    Row = Row + 1
Wend

相关内容