我差不多完成了代码,但是我只能提取一个员工ID ID。请参阅以下代码:
Private Sub CommandButton24_Click()
Dim outApp As Object 'Application
Dim outTI As Object 'TaskItem
Dim outRec As Object 'Recipient
Dim outAL As Object 'AddressList
Set outApp = GetObject(, "Outlook.Application")
Set outAL = outApp.Session.AddressLists.Item("Global Address List")
Set outTI = outApp.CreateItem(3)
outTI.Assign
Set outRec = outTI.Recipients.Add(Range("A2").Value)
outRec.Resolve
If outRec.Resolved Then
Range("B2").Value = outAL.AddressEntries(outRec.AddressEntry.Name).GetExchangeUser.PrimarySmtpAddress
Else
MsgBox "Couldn't find Employee"
End If
End Sub
看起来需要在此代码中进行一些更改,以便我可以从列表中提取电子邮件地址。
Set outRec = outTI.Recipients.Add(Range("A2").Value)
答案 0 :(得分:0)
如果您的列表位于A列,则尝试循环遍历列
示例
{{1}}