使用Excel VBA将Skype消息发送到现有组

时间:2016-10-04 17:10:07

标签: excel vba chat skype

我发现此代码可以与Skype中的组创建聊天

1)我需要能够向现有 Skype群组发送消息。

2)当我运行下面的代码(当它到达第9行)时,我得到一个“需要对象”错误,我没有这样做。

有人可以帮我解决这两个问题吗?

Sub Test2()

  Dim aSkype As SKYPE4COMLib.Skype
  Dim oMembers As SKYPE4COMLib.UserCollection
  Set aSkype = New SKYPE4COMLib.Skype
  Dim oChat As Chat
  Dim skUser As SKYPE4COMLib.User

  Set oMembers = CreateObject("Skype4COM.UserCollection")

  oMembers.Add (oSkype.User("skypeuser1"))
  oMembers.Add (oSkype.User("skypeuser2"))
  oMembers.Add (oSkype.User("skypeuser3"))

  Set oChat = oSkype.CreateChatMultiple(oMembers)
  oChat.OpenWindow
  oChat.Topic = "Group Chat Topic"
  oChat.SendMessage "automated message"

End Sub

1 个答案:

答案 0 :(得分:0)

Sub Test2()

    Dim aSkype As SKYPE4COMLib.Skype
    Set aSkype = New SKYPE4COMLib.Skype

    Dim oChat As Chat
    Dim oMembers As Object
    Dim skUser As SKYPE4COMLib.User

    Set oMembers = CreateObject("Skype4COM.UserCollection")
    oMembers.Add aSkype.User("username1")
    oMembers.Add aSkype.User("username2")


    Set oChat = aSkype.CreateChatMultiple(oMembers)
    oChat.OpenWindow
    oChat.Topic = "Your Group Chat Topic"
    oChat.SendMessage "automated message"

End Sub