GetAddress does not provide all fields

B

Bo Hansson

I'm working with a Word VBA application in Office 2000 under Windows XP.

The code below returns all fields, except for the last three (
"<PR_STREET_ADDRESS>", "<PR_POSTAL_CODE>" and "<PR_LOCALITY>").
They are all empty.

I have tried a lot of suggested ways to find the cause of the problem, see
the earlier thread "Importing Outlook Contacts data into Word VBA?" , but
with no success.
Now I have to get more ideas from the exellent solution providers of this
discussion group. You are all welcome!

My code:

Dim strAddress, strCode, strFnamn, strEnamn, strTel, strMobil, strEpost,
strGata, strPostNr, strOrt As String

strFnamn = "<PR_GIVEN_NAME>"
strEnamn = "<PR_SURNAME>"
strTel = "<PR_HOME_TELEPHONE_NUMBER>"
strMobil = "<PR_CELLULAR_TELEPHONE_NUMBER>"
strEpost = "<PR_EMAIL_ADDRESS>"
strGata = "<PR_STREET_ADDRESS>"
strPostNr = "<PR_POSTAL_CODE>"
strOrt = "<PR_LOCALITY>"

strCode = strFnamn & "$1" & strEnamn & "$2" & strTel & "$3" & strMobil &
"$4" & strEpost _
& "$5" & strGata & "$6" & strPostNr & "$7" & strOrt

strAddress = Application.GetAddress(AddressProperties:=strCode,
DisplaySelectDialog:=1)

MsgBox strAddress
 
J

Jean-Guy Marcil

Bo Hansson was telling us:
Bo Hansson nous racontait que :
I'm working with a Word VBA application in Office 2000 under Windows
XP.

The code below returns all fields, except for the last three (
"<PR_STREET_ADDRESS>", "<PR_POSTAL_CODE>" and "<PR_LOCALITY>").
They are all empty.

I have tried a lot of suggested ways to find the cause of the
problem, see the earlier thread "Importing Outlook Contacts data into
Word VBA?" , but with no success.

I read that thread, and if I remember correctly, one suggestion made by zkid
was not, I think , followed through:

Did you try to create a fresh new contact for testing purposes and enter the
address in the address, city and zip code fields. Then see if this contact
returns something or not.

Finally, have you tested a mail merge with the Outlook address book and see
if that returns something or not?


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
B

Bo Hansson

Yes, I made a fresh new contact and had the same problem with that one.
Mail merge works, but is no test of the fields I have problems with - or, am
I wrong....?

/BosseH
 
B

Bo Hansson

I can add a bit of news.
Its obvious that GetAddress cannot read the address fields in the address
book. When I build a code string (strCode =......) that starts with address
fields and ends with name, phone and emailaddress, it returns a string where
the first address fields are emtpty while the final fields fields are
correct..

Does this give anyone a cloe?

/BosseH
 
J

Jean-Guy Marcil

Bo Hansson was telling us:
Bo Hansson nous racontait que :
Yes, I made a fresh new contact and had the same problem with that
one. Mail merge works, but is no test of the fields I have problems
with - or, am I wrong....?

All I can say at this point is that if the cod you posted works on 2
machines (zkid's and mine) but not on yours, then chances are that there is
something wrong at your end of things.

You mentioned having problem with Outlook. At this point, I must agree with
zkid (other thread) that there is some kind of corruption in your .pst file.
Try the slapstick site for tools to fix the .pst file, or zkid's idea.

Good luck!

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
G

Graham Mayor

It sounds as though the address fields have not been correctly entered or
the PST file has errors. You could start by using the SCANPST utility (it's
in the folder C:\Program Files\Common Files\System\MSMAPI\1033) to repair
your data file.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
B

Bo Hansson

Hi Graham

I have run the SCANPST utility on the Outlook.pst file, and was told that
some corrections were made. But the problem still remains!

I must admit that I know nothing about pst files. Looking into the directory
where the Outlook.pst file resides, I also see two other files with pst
extension:
- archive.pst
- Personal directories(1).pst

When trying the SCANPST utility on the last one of those, I get a message
that the file is used by another application. This message is repeated even
after I have closed all applications, it looks like something has been
hanged up.

I'm quite convinced that something was spoiled when I tried to import
contacts from an earlier computer setup with Outlook 2003. At that occasion
I got some messages about incompatibility. I have also tried to repair and
reinstall Office 2000, but cannot get rid of the problem.

/BosseH
 
G

Graham Mayor

Outlook 2003 uses a different file format from Outlook 2000 and they are not
entirely backward compatible. You really need to move this question to an
Outlook forum as it appears the problems are Outlook issues and not Word.

I take it that you have the same verions of Word and Outlook. If they are
from a different Office set, I am not surprised it doesn't work.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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

Similar Threads


Top