• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

With VB6 how can I open the Address Book window from Outlook.

With VB6 how can I open the Address Book window from Outlook.

Thanks
0
jlcere
Asked:
jlcere
  • 2
1 Solution
 
raja_ind82Commented:
Hi,
Please see the code to collect the email address from the outlook
Add outlook reference

Private Sub Command1_Click()
 ' Set up Outlook objects.
   Dim ol As New Outlook.Application
   Dim olns As Outlook.NameSpace
   Dim cf As Outlook.MAPIFolder
   Dim c As Outlook.ContactItem
   Dim objItems As Outlook.Items
   Dim Prop As Outlook.UserProperty

   Set olns = ol.GetNamespace("MAPI")
   Set cf = olns.GetDefaultFolder(olFolderContacts)
   Set objItems = cf.Items
   iNumContacts = objItems.Count
   If iNumContacts <> 0 Then
      For i = 1 To iNumContacts
         If TypeName(objItems(i)) = "ContactItem" Then
            Set c = objItems(i)
             List1.AddItem c.FullName & " - " & c.Email1Address
         End If
      Next i
      MsgBox "Finished."
   Else
      MsgBox "No contacts to export."
   End If
End Sub

Regards,
M.Raja
0
 
jlcereAuthor Commented:
Thanks to help me.

If my address book have several folders, how can I select a specific one.
Ex. I have my personal contact, the office contact....

And do you have a link where I can learn the code you wrote.

Thanks again.
0
 
raja_ind82Commented:
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now