Results 1 to 7 of 7

Excel data export to Outlook 2007 contact list using VBA

Threaded View

  1. #1
    Forum Contributor nuttycongo123's Avatar
    Join Date
    01-26-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    149

    Excel data export to Outlook 2007 contact list using VBA

    Hi Guys,
    I have following queries regarding Outlook 2007 contact management .I am trying to export excel format using the following code to outlook 2007,contacts list, but its not working ..can someone assist me in sorting this out ..i am attaching the format i need to export and here is the code i am using
    Dim appOutlook As Outlook.Application
    Dim objNameSpace As Outlook.Namespace
    Dim objContactFolder As Outlook.MAPIFolder
    Dim objContacts As Outlook.ContactItem
    'Dim myDistList As Outlook.DistListItem
    Sub ContList()
     
    Set appOutlook = GetObject(, "Outlook.Application")
    Set objNameSpace = appOutlook.GetNamespace("MAPI")
    Set objContactFolder = objNameSpace.GetDefaultFolder(olFolderContacts)
    Set myMailItem = appOutlook.CreateItem(olMailItem)
    Set myRecipients = myMailItem.Recipients
    'Set myDistList = appOutlook.CreateItem(olDistributionListItem)
    For i = 3 To Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Set objContacts = objContactFolder.Items.Add(olContactItem)
    With objContacts
        '.Secs = Range("B" & i).Value '.CompanyName = Range("B" & i).Value
        .BusinessName = Range("C" & i).Value '.LastName = Range("C" & i).Value
        .ContactName = Range("D" & i).Value '.FirstName = Range("D" & i).Value
        .Custemail = Range("E" & i).Value '.BusinessAddress = Range("E" & i).Value
        .Traderemail = Range("F" & i).Value '.BusinessAddressCity = Range("F" & i).Value
        .salesemail = Range("G" & i).Value '.BusinessAddressState = Range("G" & i).Value
        .BusinessAddressPostalCode = Range("H" & i).Value
        .BusinessAddressCountry = Range("I" & i).Value
        .JobTitle = Range("J" & i).Value
        .BusinessTelephoneNumber = Range("K" & i).Value
        .BusinessFaxNumber = Range("L" & i).Value
        .Email1Address = Range("E:G" & i).Value '.Email1Address = Range("M" & i).Value
        .Body = Range("N" & i).Value
        .Save
    End With
     
        myRecipients.Add (Range("E" & i).Value)
     
     
       Next
     
       myRecipients.ResolveAll
       myDistList.AddMembers myRecipients
       myDistList.Display
     
    End Sub
    I have posted the same query on the following link as well: http://forums.techguy.org/business-a...ml#post7797407

    Regards
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1