如何在Excel VBA中取得同事的Lync在线状态?
公司部署的是Excel 2013及Lync 2013 (Lync即Office Communicator), 有没有什么办法在Excel VBA中访问Lync的对象,取得同事的在线状态?
在网上能搜到的就是下面的代码片段,不过电脑上没看到CommunicatorAPI,可能Lync不支持吧,其他一些方法都要.net已经Visual Studio,很想知道能不能就用VBA解决这个需求?有经验的分享一下,谢谢。
Public Sub User_Status_OCS()
Dim myOCS As New CommunicatorAPI.Messenger 'Office Communicator API
Dim OCS_User_Mail_ID As String
Dim curr_status As Integer
Dim flag As Integer
Dim stat As String
stat = ""
OCS_User_Mail_ID = "User@mail.com" 'Change the Mail ID to USER Mail.
curr_status = myOCS.GetContact(OCS_User_Mail_ID, myOCS.MyServiceId).Status
If curr_status = 34 Then stat = "Away"
If curr_status = 10 Then stat = "Busy"
If curr_status = 18 Then stat = "Idle"
If curr_status = 1 Then stat = "Offline"
If curr_status = 2 Then stat = "Online"
If curr_status = 0 Then stat = "Unknown"
MsgBox "User:" & OCS_User_Mail_ID & " OCS Status = " & stat
End Sub