title: Send instant message on Office Communicator using Excel VBA
body: <p>I want to send instant message using Office Communicator and Excel VBA. I use an excel sheet containing a list of Email IDs. </p>
  
  <pre><code>**A            B    C**
  Serial No   Name    Email
  1            abc    abc.abc@abc.com
  2            xyz    xyz.xyz@xyz.com
  3            pqr    pqr.pqr@pqr.com
  </code></pre>
  
  <p>I wrote the below code to send message. But it is not working. I have enabled Communicator reference in VBA.</p>
  
  <pre><code>Sub sendIM()
  Dim msgr As CommunicatorAPI.IMessengerConversationWndAdvanced
  Dim ToUser As String
  Dim message As String
  Application.ScreenUpdating = True
      For Each cell In Columns("C").Cells.SpecialCells(xlCellTypeConstants)
      On Error Resume Next
          If cell.Value Like "?*@?*.?*" Then
                  ToUser = Chr(34) &amp; cell.Value &amp; Chr(34)
                  'MsgBox ToUser
                  message = "Hi " &amp; Cells(cell.Row, "B").Value _
                        &amp; vbNewLine &amp; vbNewLine &amp; _
                          "HOW ARE YOU"
                  Set msgr = Messenger.InstantMessage(ToUser)
                  msgr.SendText (message)
          End If
      Next cell
  Application.ScreenUpdating = True
  End Sub 
  </code></pre>
  
  <p>For a single email id, it is working. I use the below mentioned code to send single message.</p>
  
  <pre><code>Sub sendIM()
  Dim msgr As CommunicatorAPI.IMessengerConversationWndAdvanced
  Dim ToUser As String
  Dim message As String
  Application.ScreenUpdating = True
  ToUser = "abc.abc@abc.com"
  message = "hai"
  On Error Resume Next
  Set msgr = Messenger.InstantMessage(ToUser)
  msgr.SendText (message)
  Application.ScreenUpdating = True
  End Sub
  </code></pre>
  
  <p>But I need to loop through the sheet so that the message is sending to everyone.  What changes I have to make this work ?</p>
  
  <p><em>Note: The Email Ids here I mentioned is not real.</em></p>