How to add an address entry 
Author Message
 How to add an address entry

Hi,

I have an Excel-Sheet with email-addresses. Now I want to create new
address-entries with them within my Outlook (2K) - Addressbook with VBA.
But I don't find the correct syntax. Who can help?
--
Thanks in advance

Hans-Elmar Kliebisch, Germany
Win XP Home, Office 2000



Thu, 14 Jul 2005 05:54:32 GMT  
 How to add an address entry
For each address, you'll need to create a new ContactItem:

Set objOL = CreateObject("Outlook.Application")
Set objContact = objOL.CreateItem(olContactItem)
With objContact
    .FirstName = "Hans-Elmar"
    .LastName = "Kliebisch"

    .Save
End With

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
     Microsoft Outlook Programming: Jumpstart
     for Administrators, Power Users, and Developers
     http://www.slipstick.com/books/jumpstart.htm

Quote:

> Hi,

> I have an Excel-Sheet with email-addresses. Now I want to create new
> address-entries with them within my Outlook (2K) - Addressbook with VBA.
> But I don't find the correct syntax. Who can help?
> --
> Thanks in advance

> Hans-Elmar Kliebisch, Germany
> Win XP Home, Office 2000



Fri, 15 Jul 2005 22:32:52 GMT  
 How to add an address entry
Hi, Sue,

thanks, this is almoust what I looked for. But in your solution the new
contact item is generated within the default contact-folder. I use
subfolders, which are declared as contact-folders, too. How can I address
them instead?

--
Kind regards to the other edge of the world ;o)

Hans-Elmar Kliebisch
Win XP Home, Office 2000


For each address, you'll need to create a new ContactItem:

Set objOL = CreateObject("Outlook.Application")
Set objContact = objOL.CreateItem(olContactItem)
With objContact
    .FirstName = "Hans-Elmar"
    .LastName = "Kliebisch"

    .Save
End With

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
     Microsoft Outlook Programming: Jumpstart
     for Administrators, Power Users, and Developers
     http://www.slipstick.com/books/jumpstart.htm


Quote:
> Hi,

> I have an Excel-Sheet with email-addresses. Now I want to create new
> address-entries with them within my Outlook (2K) - Addressbook with VBA.
> But I don't find the correct syntax. Who can help?
> --
> Thanks in advance

> Hans-Elmar Kliebisch, Germany
> Win XP Home, Office 2000



Sat, 16 Jul 2005 01:17:10 GMT  
 How to add an address entry
To create an item in a non-default folder, use the Add method on the target folder's Items collection.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
     Microsoft Outlook Programming: Jumpstart
     for Administrators, Power Users, and Developers
     http://www.slipstick.com/books/jumpstart.htm
Quote:

> Hi, Sue,

> thanks, this is almoust what I looked for. But in your solution the new
> contact item is generated within the default contact-folder. I use
> subfolders, which are declared as contact-folders, too. How can I address
> them instead?



> For each address, you'll need to create a new ContactItem:

> Set objOL = CreateObject("Outlook.Application")
> Set objContact = objOL.CreateItem(olContactItem)
> With objContact
>     .FirstName = "Hans-Elmar"
>     .LastName = "Kliebisch"

>     .Save
> End With



> > Hi,

> > I have an Excel-Sheet with email-addresses. Now I want to create new
> > address-entries with them within my Outlook (2K) - Addressbook with VBA.
> > But I don't find the correct syntax. Who can help?
> > --
> > Thanks in advance

> > Hans-Elmar Kliebisch, Germany
> > Win XP Home, Office 2000



Sat, 16 Jul 2005 01:59:35 GMT  
 How to add an address entry
Hello, Sue,

could you give me a short example for a folder named "Contacts_1" as a
subfolder of the default contacts-folder?
Thank you!

Hans-Elmar Kliebisch
Win XP Home, Office 2000



To create an item in a non-default folder, use the Add method on the target
folder's Items collection.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
     Microsoft Outlook Programming: Jumpstart
     for Administrators, Power Users, and Developers
     http://www.slipstick.com/books/jumpstart.htm


Quote:
> Hi, Sue,

> thanks, this is almoust what I looked for. But in your solution the new
> contact item is generated within the default contact-folder. I use
> subfolders, which are declared as contact-folders, too. How can I address
> them instead?



> For each address, you'll need to create a new ContactItem:

> Set objOL = CreateObject("Outlook.Application")
> Set objContact = objOL.CreateItem(olContactItem)
> With objContact
>     .FirstName = "Hans-Elmar"
>     .LastName = "Kliebisch"

>     .Save
> End With



> > Hi,

> > I have an Excel-Sheet with email-addresses. Now I want to create new
> > address-entries with them within my Outlook (2K) - Addressbook with VBA.
> > But I don't find the correct syntax. Who can help?
> > --
> > Thanks in advance

> > Hans-Elmar Kliebisch, Germany
> > Win XP Home, Office 2000



Sat, 16 Jul 2005 04:59:07 GMT  
 How to add an address entry
Sure:

    Set objOL = CreateObject("Outlook.Application")
    Set objNS = objOL.GetNamespace("MAPI")
    Set objContFold = objNS.GetDefaultFolder(olFolderContacts)
    Set objFolder = objContFolder.Folders("Contacts_1")
    Set objContact = objFolder.Items.Add
    ' set properties for objContact and save
etc.

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
     Microsoft Outlook Programming: Jumpstart
     for Administrators, Power Users, and Developers
     http://www.slipstick.com/books/jumpstart.htm

Quote:

> could you give me a short example for a folder named "Contacts_1" as a
> subfolder of the default contacts-folder?



> To create an item in a non-default folder, use the Add method on the target
> folder's Items collection.



Sat, 16 Jul 2005 06:38:19 GMT  
 How to add an address entry
Thanks a lot ! That means much less tries and errors :-)

Bye for now

Hans-Elmar Kliebisch
Win XP Home, Office 2000


Sure:

    Set objOL = CreateObject("Outlook.Application")
    Set objNS = objOL.GetNamespace("MAPI")
    Set objContFold = objNS.GetDefaultFolder(olFolderContacts)
    Set objFolder = objContFolder.Folders("Contacts_1")
    Set objContact = objFolder.Items.Add
    ' set properties for objContact and save
etc.

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
     Microsoft Outlook Programming: Jumpstart
     for Administrators, Power Users, and Developers
     http://www.slipstick.com/books/jumpstart.htm


Quote:

> could you give me a short example for a folder named "Contacts_1" as a
> subfolder of the default contacts-folder?



> To create an item in a non-default folder, use the Add method on the
target
> folder's Items collection.



Sat, 16 Jul 2005 15:31:29 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Resort after adding entry to a Name/Address table

2. Programatic control of e-mail address when adding an entry to a distributionList

3. How to Add Address Entries

4. Microsoft Exchange Mapi Visual Basic adding entries to address book

5. Retrieve SMTP email addresses of GAB address entries

6. cdo problem retrieving business address from entry in address book

7. Adding New Addresses To The Personal Address Book

8. Need to add name and address to address book

9. Resolve OL address book entries

10. Automated Address Entry

11. OL97 Address Book entry creation error

12. Hiding Entries from the Global Address List

 

 
Powered by phpBB® Forum Software