Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-22-2016, 06:43 AM
charmise charmise is offline Adding Company Name to Contact Group Windows 7 32bit Adding Company Name to Contact Group Office 2010 32bit
Novice
Adding Company Name to Contact Group
 
Join Date: Apr 2016
Posts: 1
charmise is on a distinguished road
Default Adding Company Name to Contact Group

Hi All,

I am using Outlook 2010 on a PC. I have contact groups. The contact groups only show the persons name and email. I would like to show the company name in the contact group. I need to do compile a list for a survey and I need the company name. I will export this list to Excel. Any help is much appreciated. Thanks.
Reply With Quote
  #2  
Old 04-23-2016, 05:58 AM
gmayor's Avatar
gmayor gmayor is offline Adding Company Name to Contact Group Windows 10 Adding Company Name to Contact Group Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

That was an interesting problem that required a little lateral thinking, but the following appears to work. You need to change the items were indicated if necessary. I chose a CSV file as the destination which is much faster than faffing around with Excel, while being Excel compatible. I have not added any error correction so you need to select the Distribution liost and run the macro - once!

Code:
Option Explicit
Const strPath As String = "C:\Path\ContactGroup.csv" 'The full name of the CSV file to be created.

Sub GetList()
Dim olNS As NameSpace
Dim olItem As DistListItem
Dim olAddrList As AddressList
Dim olContact As AddressEntry
Dim sContact As String
Dim sName As String
Dim sCompany As String
Dim sAddress As String
Dim i As Long
    sContact = "Company,Name,E-Mail"
    AddToCSV sContact
    Set olNS = GetNamespace("MAPI")
    Set olAddrList = olNS.AddressLists("Contacts") 'The name of the contacts' list

    'On Error Resume Next
    Set olItem = ActiveExplorer.Selection.Item(1)
    For i = 1 To olItem.MemberCount
        sAddress = olItem.GetMember(i).Address
        sName = Replace(Trim(Split(olItem.GetMember(i).Name, "(")(0)), ",", " ")
        Set olContact = olAddrList.AddressEntries(sName)
        sCompany = olContact.GetContact.CompanyName
        AddToCSV sCompany & "," & sName & "," & sAddress
    Next i
    MsgBox strPath & " created"
lbl_Exit:
    Exit Sub
End Sub


Sub AddToCSV(strLine As String)
'Graham Mayor - www.gmayor.com
'strline is the line of text to be added
Dim oFSO As Object
Dim oFile As Object
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    Set oFile = oFSO.OpenTextFile(strPath, 8, True, 0)
    oFile.Write strLine & vbCrLf
    oFile.Close
lbl_Exit:
    Set oFSO = Nothing
    Set oFile = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 05-04-2016, 11:35 PM
Anjlua Anjlua is offline Adding Company Name to Contact Group Windows 7 32bit Adding Company Name to Contact Group Office 2013
Advanced Beginner
 
Join Date: May 2016
Posts: 35
Anjlua is on a distinguished road
Default

Hi Cahrmise,

Outlook provides many features, exporting is one of those. Using Outlook to export contacts to MS Excel, do these steps:

Start Outlook >> click File >> click Import and Export...
Click Export to a file >> click on Next >> select Microsoft Excel >> click Next
Select Contacts from the folder list >> click Next
Click Browse and provide the location and name of a file to save the contacts as a CSV file format
Click Next >> click Finish.

Note: the time taken to complete the exporting process depends on the size of your contact list.

Thanks & Regards
Anjlua
Reply With Quote
  #4  
Old 05-05-2016, 12:41 AM
gmayor's Avatar
gmayor gmayor is offline Adding Company Name to Contact Group Windows 10 Adding Company Name to Contact Group Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Quote:
Originally Posted by Anjlua View Post
Outlook provides many features, exporting is one of those.
That's all very well, but the requirement was to compile a list of the members of a contact group, with their company names (which are not included in the contact group).
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk add .csv list to a GAL Contact Group? ShaneK2 Outlook 0 01-09-2015 09:52 PM
Contact Group Disapeared Edmartinez Outlook 0 12-17-2013 07:56 AM
Adding Company Name to Contact Group Contact group inbox colour help bwhinmk Outlook 1 10-21-2013 05:34 PM
Adding company templates into Powerpoint dennisv PowerPoint 0 04-09-2012 11:39 PM
Associate a contact with a group from within the contact page? SeattleALE Outlook 1 05-09-2011 04:00 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:23 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft