View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SyrU SyrU is offline
external usenet poster
 
Posts: 2
Default MS Exchange Macro

I have a macro that opens the Address Book on our server and then you put in
the display name you want and it gives you a certain set of pre-determined
info. (This works great).

I want to cut out the Address Book part and have it read from a list
instead. I am a little stuck. Here is the code:
I have a spreadsheet that contains the PR_DISPLAY_NAME. I know how to
create the loop, just need a little assistance with the objRecipients and
LoadFieldsFromAB subroutine.


HomeServer = ""
strProfileInfo = "ct00" & vbLf & "anon"
Set objSession = CreateObject("MAPI.Session")
objSession.logon , , False, False, , True, strProfileInfo

Set objRecipients = objSession.AddressBook(, "Select Account", True, True,
0)
LoadFieldsFromAB objRecipients.Item(1).AddressEntry

----------------------------------------------------------------------------
Sub LoadFieldsFromAB(objAccount)

DisplayName = objAccount.fields(PR_DISPLAY_NAME).Value
DisplayAccount = objAccount.fields(PR_ACCOUNT).Value
HomeServer = objAccount.fields(PR_EMS_AB_HOME_MTA).Value
strSMTPdomain = "frd.com"

MsgBox (DisplayName)
MsgBox (DisplayAccount)
MsgBox (Mid(HomeServer, 47, 11))

Set objSession = Nothing