vba - Separate multiple selected address from GetAddress Method -


this simple question really.
i'm having hard time solve it.

background:

i'm trying email address using .getaddress method of word.application object.
now, don't have problem if user selects single to , cc recipients.
problem occurs when multiple emails selected user.
example, user selects 2 email address , 1 group list.

rawrecip = application.getaddress(, "<pr_display_name>", , 1, 2, true) debug.print rawrecip 

using above code produces:

smith, john, joe, jane, all-hq group 

each address selected separated <comma><space>.
problem surname , givenname separated same.
need display name of 3 address selected user.
split function doesn't me anywhere since cannot find or generate unique delimiter separate 3 display name.

is there clean way want?

smith, john joe, jane all-hq group 

unbelievable. answer in front of me.
posting answer in case needs it.
need add character in getaddress method.

edit:using space character gives best result

rawrecip = application.getaddress(, "<pr_display_name>" & " ", , 1, 2, true) 

it produce:

smith, john , joe, jane , all-hq group  

then can use split function , text manipulation desired result.

dim integer, dname dname = split(rawrecip, " , ") = lbound(dname) ubound(dname)     debug.print dname(i) next 

and result:

smith, john joe, jane all-hq group 

note:with space on last entry


Comments