Exercise to find the method and convert to a function
Solution: Function GetUsersEmailAddress() Dim OL As Object, olAllUsers As Object, oExchUser As Object, oentry As Object, myitem As Object Dim User As String Set OL = CreateObject("outlook.application") Set olAllUsers = OL.Session.AddressLists.Item("All Users").AddressEntries User = OL.Session.CurrentUser.Name Set oentry = olAllUsers.Item(User) Set oExchUser = oentry.GetExchangeUser() GeUsersEmailAddress = oExchUser.PrimarySmtpAddress End Function |