Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Macro for getting Oulook-address into an Excel worksheet?

4 views
Skip to first unread message

Camilla B

unread,
Jan 21, 2002, 4:42:01 AM1/21/02
to
I'm working on a Excel (2000) workbook/template in which I want to get an
address from Outlook (2000). The template is going to be used for making
invoices, with name and address of the customer in G7 to G9. All customers
are stored in Outlook, therefore I need to be able to import the address
from my Outlook Addressbook/Contacts. I would like to automate this job with
an "as-easy-as-possible" solution for doing this, most preferably just click
a button, so I suppose I have to use a macro for doing it? Any help welcome!

Thanks in advance
Camilla B

Tfelt Jean-Yves

unread,
Jan 23, 2002, 4:25:16 AM1/23/02
to
Hi Camilla,
In VBA, make a ref via tool/references to outlook
This sub will get you started

Public Sub test()
Dim r As AddressEntry
Dim myItem
Dim myNameSpace
Dim myGAddressList As AddressList
Dim mygentries As AddressEntries

Dim myolapp As Application

Set myNameSpace = Outlook.GetNamespace("MAPI")
Set myGAddressList = myNameSpace.AddressLists("Global Address List")
'or contacts
Set mygentries = myGAddressList.AddressEntries

For Each r In mygentries
Debug.Print r.Name
Next
'do your stuff
End Sub
Regards
Jean-Yves

Camilla B

unread,
Jan 24, 2002, 3:16:41 AM1/24/02
to
Many thanks! I will try this at once!

Camilla
"Tfelt Jean-Yves" <jean-yv...@eurocontrol.int> skrev i meddelandet
news:3C4E817C...@eurocontrol.int...

0 new messages