getaddress method

S

Shane Rockey

I've created a word macro that uses the getaddress method
to pull information from outlook then start a letter and
insert fields. If I use the following code

addr = Application.GetAddress()
Selection.TypeText Text:="" & addr

it works fine but I can't select fields other than the
mailing address to insert.

To fix this I used the follwing

strToName = Application.GetAddress(Name:="", _
AddressProperties:="<PR_DISPLAY_NAME>",
UseAutoText:=False, _
Displayselectdialog:=1)
addr = Application.GetAddress(Name:=strToName,
Displayselectdialog:=0)
salute = Application.GetAddress(Name:=strToName, _
AddressProperties:="<PR_GIVEN_NAME>",
UseAutoText:=False, _
Displayselectdialog:=0)
Selection.TypeText Text:="" & addr
(and then I continue using the salute and StrToName
fields in the rest of the letter)

However, using this latter code, If I select a contact
without an email or fax number I get a error saying
microsoft exchange could not recognize the name. As long
as I use a contact with an email or fax number it works
fine.

Also if I pick a contact with both and email and a fax
number the macro makes me choose the correct contact each
time I use a piece of information from outlook.

Anyone have any idea how to fix this.
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top