0
我从用户那里获得交换在线地址,但我想转换或以某种方式获取它们的SMTP地址。VBA - 将Exchange Online电子邮件地址转换为SMTP地址
我不知道如何从Email1Address获取SMTP地址。
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
Set objContactsFolder = objNS.GetDefaultFolder(olFolderContacts)
Set objItems = objContactsFolder.Items
For Each obj In objItems
'Test for contact and not distribution list
If obj.Class = olContact Then
Set objContact = obj
With objContact
If .Email1Address <>"" Then
'I want to add the SMTP-Address after the .LastNameAndFirstName of a User
strFileAs = .LastNameAndFirstName
.Email1DisplayName= strFileAs
.Save
End If
End With
End If
Err.Clear
Next
什么是你已经尝试过,哪些没有工作的代码? – QHarr
搜索'ResolveDisplayNameToSMTP' - 你正在寻找的代码是Sue Mosher。 –
请参阅[如何将基于Exchange的电子邮件地址转换为SMTP电子邮件地址](https://www.add-in-express.com/creating-addins-blog/2009/05/08/outlook-exchange-email-address -smtp /)。 –