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
Comments
Post a Comment