A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - General Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Build a userform on excel to copy contacts from outlook 2003



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 2nd 07, 04:25 PM posted to microsoft.public.excel.programming,microsoft.public.outlook.program_vba,microsoft.public.outlook
Oggy
external usenet poster
 
Posts: 18
Default Build a userform on excel to copy contacts from outlook 2003

I am a beginner in VBA and require abit of help. I am trying to setup a
userform on excel 2003 to select and copy into excel, names and
addresses from the contacts folder in outlook 2003. This will then save
me having my contacts in a seperate database as well as outlook.

Many thanks in advance!

  #2  
Old January 2nd 07, 05:08 PM posted to microsoft.public.excel.programming,microsoft.public.outlook,microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Build a userform on excel to copy contacts from outlook 2003

This macro should get you started. It will loop through all your Contact
items; you can use the objContact object to retrieve Contact item properties
for display in whatever controls you use on your UserForm.

Sub LoopThroughContacts()
On Error Resume Next

Dim objContact As Outlook.ContactItem, objContactFolder As
Outlook.MAPIFolder
Dim objContactItems As Outlook.Items, objNS As Outlook.NameSpace
Dim intX As Integer

Set objNS = Application.GetNamespace("MAPI")
Set objContactFolder = objNS.GetDefaultFolder(olFolderContacts)
Set objContactItems = objContactFolder.Items

For intX = 1 To objContactItems.Count
If objContactItems.Item(intX).Class = olContact Then
Set objContact = objContactItems.Item(intX)
Debug.Print objContact.FullName
End If
Next

Set objContact = Nothing
Set objContactItems = Nothing
Set objContactFolder = Nothing
Set objNS = Nothing
End Sub

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Oggy" wrote:

I am a beginner in VBA and require abit of help. I am trying to setup a
userform on excel 2003 to select and copy into excel, names and
addresses from the contacts folder in outlook 2003. This will then save
me having my contacts in a seperate database as well as outlook.

Many thanks in advance!


  #3  
Old January 2nd 07, 05:48 PM posted to microsoft.public.excel.programming,microsoft.public.outlook,microsoft.public.outlook.program_vba
Oggy
external usenet poster
 
Posts: 18
Default Build a userform on excel to copy contacts from outlook 2003

Thanks Eric,

This is what i am loking for, sorry to be a pain or thick! A couple
quick questions if i may,
Does the macro go under the userform or to the combo box,
In the combo box properties which field to i need to edit so that i can
see my contacts

Thanks in advance for all your help

Regards

Oggy


Eric wrote:
This macro should get you started. It will loop through all your Contact
items; you can use the objContact object to retrieve Contact item properties
for display in whatever controls you use on your UserForm.

Sub LoopThroughContacts()
On Error Resume Next

Dim objContact As Outlook.ContactItem, objContactFolder As
Outlook.MAPIFolder
Dim objContactItems As Outlook.Items, objNS As Outlook.NameSpace
Dim intX As Integer

Set objNS = Application.GetNamespace("MAPI")
Set objContactFolder = objNS.GetDefaultFolder(olFolderContacts)
Set objContactItems = objContactFolder.Items

For intX = 1 To objContactItems.Count
If objContactItems.Item(intX).Class = olContact Then
Set objContact = objContactItems.Item(intX)
Debug.Print objContact.FullName
End If
Next

Set objContact = Nothing
Set objContactItems = Nothing
Set objContactFolder = Nothing
Set objNS = Nothing
End Sub

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Oggy" wrote:

I am a beginner in VBA and require abit of help. I am trying to setup a
userform on excel 2003 to select and copy into excel, names and
addresses from the contacts folder in outlook 2003. This will then save
me having my contacts in a seperate database as well as outlook.

Many thanks in advance!



  #4  
Old January 2nd 07, 06:13 PM posted to microsoft.public.excel.programming,microsoft.public.outlook,microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Build a userform on excel to copy contacts from outlook 2003

Your code should go in the UserForm_Initialize event. When working with
combo boxes, use code like this to add data to it:

ComboBox1.AddItem "My string"

However, we're now deviating from Outlook specific programming questions as
your current issues relate to general programming in VBA. I'll be glad to
help you with the Outlook stuff, but I'd recommend a good book or other
resources on the Internet for general Visual Basic questions.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Oggy" wrote:

Thanks Eric,

This is what i am loking for, sorry to be a pain or thick! A couple
quick questions if i may,
Does the macro go under the userform or to the combo box,
In the combo box properties which field to i need to edit so that i can
see my contacts

Thanks in advance for all your help

Regards

Oggy


Eric wrote:
This macro should get you started. It will loop through all your Contact
items; you can use the objContact object to retrieve Contact item properties
for display in whatever controls you use on your UserForm.

Sub LoopThroughContacts()
On Error Resume Next

Dim objContact As Outlook.ContactItem, objContactFolder As
Outlook.MAPIFolder
Dim objContactItems As Outlook.Items, objNS As Outlook.NameSpace
Dim intX As Integer

Set objNS = Application.GetNamespace("MAPI")
Set objContactFolder = objNS.GetDefaultFolder(olFolderContacts)
Set objContactItems = objContactFolder.Items

For intX = 1 To objContactItems.Count
If objContactItems.Item(intX).Class = olContact Then
Set objContact = objContactItems.Item(intX)
Debug.Print objContact.FullName
End If
Next

Set objContact = Nothing
Set objContactItems = Nothing
Set objContactFolder = Nothing
Set objNS = Nothing
End Sub

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Oggy" wrote:

I am a beginner in VBA and require abit of help. I am trying to setup a
userform on excel 2003 to select and copy into excel, names and
addresses from the contacts folder in outlook 2003. This will then save
me having my contacts in a seperate database as well as outlook.

Many thanks in advance!




  #5  
Old January 2nd 07, 05:14 PM posted to microsoft.public.excel.programming,microsoft.public.outlook,microsoft.public.outlook.program_vba
MIKE215
external usenet poster
 
Posts: 2
Default Build a userform on excel to copy contacts from outlook 2003

Hi Oggy,

One way to accomplish your task quickly is to use the IMPORT EXPORT function
found in OUTLOOK. It allows you to export the contact list directly to
Excel. The wizzard lets you to filter and select which contact fields you
want to export. IMPORT EXPORT is found under the FILE drop down.

Regards,
Mike

"Oggy" wrote:

I am a beginner in VBA and require abit of help. I am trying to setup a
userform on excel 2003 to select and copy into excel, names and
addresses from the contacts folder in outlook 2003. This will then save
me having my contacts in a seperate database as well as outlook.

Many thanks in advance!


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Use Outlook contacts in Excel 2003 Oggy Outlook and VBA 1 January 2nd 07 06:08 AM
Use Outlook 2003 contacts in Excel 2003 Oggy Outlook - General Queries 1 January 1st 07 05:05 PM
Contacts-import from Excel 2003 to Outlook 2003 ReneBC3 Outlook - Using Contacts 1 November 1st 06 03:03 PM
Outlook 2003 shared add-in (NOT VSTO!) deployment problems build with VS2005 Ken Slovak - [MVP - Outlook] Add-ins for Outlook 1 August 2nd 06 03:29 PM
Outlook 2003: While importing contacts from Excel 2003, ISAM error Juzar Outlook - Using Contacts 1 April 10th 06 10:20 PM


All times are GMT +1. The time now is 12:31 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.