user3016664
user3016664

Reputation: 1

how to transfer all my lync 2010 contact names to excel using Excel VBA?

the only few lines of code I know about Lync probably only

Dim M As CommunicatorAPI.Messenger    
Set M = CreateObject("Communicator.UIAutomation")
Range("A1") = M.MyStatus

I realised probably can try to use .getcontact but really try so many times, so kinda need help, thank you

Upvotes: 0

Views: 1048

Answers (1)

Fagun Safi
Fagun Safi

Reputation: 61

Here is the code to get all your contacts from Lync. Hope this helps.

'.getContact' will not work as it gives you a contact as object based on sign in & service ID. One can use '.MyContacts'.

Sub getAllMyContacts()

 Dim M As CommunicatorAPI.Messenger
 Set M = CommunicatorAPI.Messenger
 Set t = M.MyContacts

 Sheet1.Cells(1, 1).Value = "Name"
 Sheet1.Cells(1, 2).Value = "Sign In ID"
 Sheet1.Cells(1, 3).Value = "Status"
 i = 2
 For Each t1 In t
    Sheet1.Cells(i, 1).Value = t1.FriendlyName
    Sheet1.Cells(i, 2).Value = t1.SigninName
    Sheet1.Cells(i, 3).Value = t1.Status
    i = i + 1
 Next
 MsgBox "Completed" 
End Sub

Upvotes: 1

Related Questions