How to add an address entry
Author |
Message |
Hans-Elmar Kliebisc #1 / 7
|
 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 |
|
 |
Sue Mosher [MVP #2 / 7
|
 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 |
|
 |
Hans-Elmar Kliebisc #3 / 7
|
 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 |
|
 |
Sue Mosher [MVP #4 / 7
|
 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 |
|
 |
Hans-Elmar Kliebisc #5 / 7
|
 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 |
|
 |
Sue Mosher [MVP #6 / 7
|
 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 |
|
 |
Hans-Elmar Kliebisc #7 / 7
|
 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 |
|
|
|