vba - Reference Outlook Account by email address -


i have found following vba, i'm using in excel vba, return each outlook account item , account number.

sub which_account_number()     dim outapp outlook.application     dim long      set outapp = createobject("outlook.application")      = 1 outapp.session.accounts.count         msgbox outapp.session.accounts.item(i) & " : account number " &     next end sub 

i want select account number associated specific email address, instead of returning them 1 after another.

you need set directly

sub which_account_number()     dim outapp outlook.application     dim desiredaccount outlook.account     set outapp = createobject("outlook.application")     set desiredaccount = outapp.session.accounts.item("desiredemail@domain.com")     msgbox desiredaccount.displayname     set desiredaccount = nothing     set outapp = nothing end sub 

probably this , this may helpful later on.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -