+ Reply to Thread
Results 1 to 16 of 16

REG:Outlook employee information

Hybrid View

laxmanann REG:Outlook employee... 03-14-2014, 07:51 AM
adyteo Re: REG:Outlook employee... 03-14-2014, 08:17 AM
laxmanann Re: REG:Outlook employee... 03-14-2014, 09:22 AM
adyteo Re: REG:Outlook employee... 03-14-2014, 09:31 AM
laxmanann Re: REG:Outlook employee... 03-14-2014, 09:40 AM
adyteo Re: REG:Outlook employee... 03-14-2014, 09:53 AM
laxmanann Re: REG:Outlook employee... 03-14-2014, 10:11 AM
adyteo Re: REG:Outlook employee... 03-14-2014, 10:24 AM
laxmanann Re: REG:Outlook employee... 03-14-2014, 10:33 AM
adyteo Re: REG:Outlook employee... 03-14-2014, 10:36 AM
laxmanann Re: REG:Outlook employee... 03-14-2014, 10:44 AM
laxmanann Re: REG:Outlook employee... 03-17-2014, 02:48 AM
adyteo Re: REG:Outlook employee... 03-17-2014, 03:44 AM
laxmanann Re: REG:Outlook employee... 03-17-2014, 04:47 AM
adyteo Re: REG:Outlook employee... 03-17-2014, 05:01 AM
laxmanann Re: REG:Outlook employee... 03-17-2014, 05:13 AM
  1. #1
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    REG:Outlook employee information

    Hi All,

    How to get the outlook contacts for the organization using excel macro vba.

    Thanks,
    Lakshmanan

  2. #2
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: REG:Outlook employee information

    have a look here:
    http://www.excelforum.com/outlook-fo...ml#post3567396
    Click on the star if you think I helped you

  3. #3
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: REG:Outlook employee information

    Hi Adyteo,

    Thanks for the response...I have seen the post which one you posted.But that is related to send mail to manager.But here my need is I want to get the details of a employee when click the employee ID.The macro which should retrieve all the details which are present in the outlook properties window..

    Requirement:

    1.General tab information
    2.Organization information
    Phone/Seat information


    The macro should fetch and display all the outlook property details present in the Outlook properties window.


    Thanks in advance.
    Lakshmanan

  4. #4
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: REG:Outlook employee information

    you wanted the info to be displayed where? I am not sure I know all the fields to display all the info. the oones I know are in the thread mentioned above

  5. #5
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: REG:Outlook employee information

    Hi Adyteo,

    Thanks for the reply.The details should be displayed in the macro embeded work sheet itself.

    The details requirement:
    The option should be present in the macro where i need to enter the employee id ad hit run to retrieve the result.

    The macro should call the oulook properties window and should retrive all the details present in the emloyee outlook properties window.If i fill 10,20..N...number of employee id and hit run means it should display all the employee's outlook properties details should display.This is the challange here.

    Thanks in advacne.
    Lakshmanan

  6. #6
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: REG:Outlook employee information

    try to use this code:
    Sub GetOutlookInfo()
    
    On Error Resume Next
    Dim I As Integer
    
    Dim ToAddr As String
    Dim ActivePersonVerified As Boolean
    Dim ol As Outlook.Application
    Dim DummyEMail As MailItem
    Dim ActivePersonRecipient As Recipient
    Dim oAE As Outlook.AddressEntry
    Dim oExUser As Outlook.ExchangeUser
    Dim oPA As Outlook.PropertyAccessor
    Dim AliasRange As Range
    Dim RowsInRange As Integer
    Dim intAreas As Integer
    Dim shtCurrentSheet As String
    
    'check whether the selection is contiguous or not. if not, exit sub
    intAreas = Selection.Areas.Count
    
    If intAreas > 1 Then
        MsgBox "Please select a contiguous area, you curently selected " & intAreas & " areas. You can have multiple cells in a single area."
        Exit Sub
    End If
    
    'create a new sheet and copy the selection there
    shtCurrentSheet = ActiveSheet.Name
    Sheets.Add After:=Sheets(Sheets.Count)
    ActiveSheet.Name = tmpSheet 'random name, see function below
    
    'add column names
    Cells(1, 1) = "email or Name"
    Cells(1, 2) = "Name"
    Cells(1, 3) = "email address"
    Cells(1, 4) = "Department"
    Cells(1, 5) = "Job Title"
    Cells(1, 6) = "Office Location"
    Cells(1, 7) = "Company"
    Cells(1, 8) = "Telephone"
    Cells(1, 9) = "Manager"
    
    Range("A1:I1").Select
    Selection.Font.Bold = True
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
    End With
    
    'copy the names into the new sheet
    Sheets(shtCurrentSheet).Activate
    Selection.Copy
    
    Sheets(Sheets.Count).Activate
    Range("A2").Select
    ActiveSheet.Paste
    
    'code taken from:
    'http://social.msdn.microsoft.com/Forums/office/en-US/183a9b77-7f5a-4afc-91e6-fbe2914c5f78/extract-data-from-the-global-address-book-with-vba?forum=outlookdev
    
    'Instantiate Outlook
    
    Set ol = CreateObject("Outlook.Application")
    'E-mail aliases are in a named range "aliasrange"
    'Assign the named range to a range object
    
    'Set AliasRange = Range("aliasrange")
    Set AliasRange = Selection
    'Create a dummy e-mail to add aliases to
    
    Set DummyEMail = ol.CreateItem(olMailItem)
    
    RowsInRange = AliasRange.Rows.Count
    'Loop through the aliases to retrieve the Exchange data
    
    For I = 1 To RowsInRange
            'Assign the current alias to a variable ToAddr
            ToAddr = AliasRange.Cells(I, 1)
            'Use the alias to create a recipient object and add it to the dummy e-mail
    
            Set ActivePersonRecipient = DummyEMail.Recipients.Add(ToAddr)
            ActivePersonRecipient.Type = olTo
            'Resolve the recipient to ensure it is valid
    
            ActivePersonVerified = ActivePersonRecipient.Resolve
            'If valid, use the  AddressEntry property of the recipient to return an AddressEntry object
    
            If ActivePersonVerified Then
                Set oAE = ActivePersonRecipient.AddressEntry
                'Use the GetExchangeUser method of the AddressEntry object to retrieve the ExchangeUser object for the recipient.
    
                Set oExUser = oAE.GetExchangeUser
                'Write the properties of the  ExchangeUser object to adjacent columns on the worksheet.
    
                AliasRange.Cells(I, 1).Offset(0, 1).Value = oExUser.Name
                AliasRange.Cells(I, 2).Offset(0, 1).Value = oExUser.PrimarySmtpAddress
                AliasRange.Cells(I, 3).Offset(0, 1).Value = oExUser.Department
                AliasRange.Cells(I, 4).Offset(0, 1).Value = oExUser.JobTitle
                AliasRange.Cells(I, 5).Offset(0, 1).Value = oExUser.City
                AliasRange.Cells(I, 6).Offset(0, 1).Value = oExUser.CompanyName
                AliasRange.Cells(I, 7).Offset(0, 1).Value = oExUser.BusinessTelephoneNumber
                AliasRange.Cells(I, 8).Offset(0, 1).Value = oExUser.Manager
            End If
            'Remove the recipient from the e-mail
            ActivePersonRecipient.Delete
    
    Next I
    
    ExitOutlookEmail:
    
        Set DummyEMail = Nothing
    
        Set ol = Nothing
    
    'autofit columns
    Columns("A:I").EntireColumn.AutoFit
    Range("A1").Select
    
    End Sub
    
    Function tmpSheet() As String
    
    Dim sLetter(8) As String, sName As String
    Dim iLetterType As Integer
    Dim I As Integer
    
    sName = ""
    For I = 0 To 7
        iLetterType = WorksheetFunction.RandBetween(1, 3)
        Select Case iLetterType
        Case 1
            sLetter(I) = Chr(WorksheetFunction.RandBetween(65, 90))
        Case 2
            sLetter(I) = Chr(WorksheetFunction.RandBetween(97, 122))
        Case 3
            sLetter(I) = Chr(WorksheetFunction.RandBetween(48, 57))
        End Select
        sName = sName & sLetter(I)
    Next
    
    tmpSheet = sName
    End Function

  7. #7
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: REG:Outlook employee information

    Hi Adyteo,

    Thanks for the code.When am trying to implement ..its throughing error..like "Comile error-User defeined type is not defined"

    Can you please share me the excel which code implemented..

    Thanks,
    Lakshmanan

  8. #8
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: REG:Outlook employee information

    What excel version are you using? if it is 2007 and newer, what you have to do is open VBA editor (Alt-F11) and then click on Tools --> References and look for Microsoft Outlook xx.0 Object Library (where xx could be 11, 14, etc). once you check that library you will be able to run the code.

  9. #9
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: REG:Outlook employee information

    Hi Adyteo,

    Thanks much.It is running with out any error..After run it is displaying only the Below item in the respective cells.even after entering the employee id of our employees it is not showing the result and detils of the oultook properties window.And am using Ms office 2010..

    email or Name Name email address Department Job Title Office Location Company Telephone Manager


    The above thing is only displaying..Can you please look into that issue and help me on the same..

    Thanks,
    Lakshmanan

  10. #10
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: REG:Outlook employee information

    you need to select the names you want the macro to get the info for: e.g. A2:a% you have 4 names (or email addresses). Select A2:A5 and then run the code.

  11. #11
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: REG:Outlook employee information

    Hi Adyteo,

    Thanks for the advice..

    Its running perfectly...But it is not retriving the "Seat NUmber" for the employee..present in the Phone/Seat tab of the outlook properties window..If i want all the information present in the out properties what i can include in the code.

    Thanks,
    LAkshmanan

  12. #12
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: REG:Outlook employee information

    Hi Adyteo,

    Here Particularily i wan to display the "Seat Number" present in the outlook properties window.Can any one take a look and help me on the same.

    Thanks,
    Lakshmanan

  13. #13
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: REG:Outlook employee information

    I do not know the filed name for that "Seat Number". I am sorry.

  14. #14
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: REG:Outlook employee information

    OK adyteo..Thanks for the info.Is there any website to serach that item ..pls share here..Else what i can do if i know the filed name.

    Thanks

  15. #15
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: REG:Outlook employee information

    you just need to add it to the code besides the other fields. If you find it, come back to the forum and post a new message in this thread.

  16. #16
    Forum Contributor
    Join Date
    02-19-2014
    Location
    NJ
    MS-Off Ver
    Excel 2010
    Posts
    308

    Re: REG:Outlook employee information

    Sure..BTW that anyone in this forum find that Seat number query means .please post.

    Thanks.
    Lakshmanan

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Pull information out of outlook to put in excel
    By trisham in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-31-2013, 05:15 PM
  2. Export outlook emails - Security information
    By joe_for_good in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-22-2011, 05:24 PM
  3. Excel 2007 : information merge to outlook calander
    By awkemrer in forum Excel General
    Replies: 0
    Last Post: 07-21-2009, 12:33 PM
  4. [SOLVED] Help :Merge 2 employee information tables
    By akhilash in forum Excel General
    Replies: 1
    Last Post: 11-29-2005, 11:50 AM
  5. Charting Employee compensation information
    By Angel45 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-20-2005, 03:09 AM

Tags for this Thread

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