1

I am trying to send a Skype message to a group of people using VBA. the below code should in theory work but I have the below error message : User-Defined type not defined for aSkype As SKYPE4COMLib.Skype

any idea ? I was wondering if this was a permission issue ?

Many thanks all

Sub Test()
  Dim aSkype As SKYPE4COMLib.Skype
  Set aSkype = New SKYPE4COMLib.Skype
  Dim oChat As Chat
  Dim skUser As SKYPE4COMLib.User

  Set oMembers = CreateObject("Skype4COM.UserCollection")
  oMembers.Add (oSkype.User("user_name1"))
  oMembers.Add (oSkype.User("user_name2"))

  Set oChat = oSkype.CreateChatMultiple(oMembers)
  oChat.OpenWindow
  oChat.Topic = "Group Chat Topic"
  oChat.SendMessage "automated message"
End Sub
romlondon
  • 11
  • 1
  • 2
  • 2
    do you have a reference to the `SKYPE4COMLib` library? – jsotola Oct 10 '17 at 17:41
  • 1
    The user needs to declare: Dim oMembers As Object – Sorceri Oct 10 '17 at 17:54
  • if you are using `skype for business`, then read this https://stackoverflow.com/questions/43139603/excel-vba-skype4comlib-is-not-working-with-skype-for-business-sfb .... apparently microsoft crippled that software product, so that it can no longer be used with VBA directly. another layer of software has to be added ... see this [UCWA](https://msdn.microsoft.com/en-us/skype/ucwa/whatsnewinucwa2_0) – jsotola Oct 10 '17 at 18:10
  • You should specify `Option Explicit`. You're declaring `aSkype` but using `oSkype`. Drop these useless [systems Hungarian](https://www.joelonsoftware.com/2005/05/11/making-wrong-code-look-wrong/) prefixes, they're obviously hurting you. Also `oMembers` isn't declared, type of `oChat` isn't qualified, and `oMembers.Add` is going to fail, because of these extraneous parentheses forcing the objects to be evaluated as values, which may only store the objects' *default member* value instead of the object itself (or throw an error if the object has no default member). – Mathieu Guindon Oct 10 '17 at 18:53

0 Answers0