Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending a message in Skype with VBA

Objective: Send a message to a Skype contact when a certain macro is done.

Sources: I searched around and found a couple of question in SO trying to do the same thing. This is the base for the code I am using Using Excel VBA to send Skype messages to Group Chat and also this https://www.mrexcel.com/forum/excel-questions/424432-sending-skype-message-through-excel-vba.html Both these questions use a similar code.

Issue: When I run the code I get the following error:

Run-time error '429': ActiveX component can't create object

on the line:

Set aSkype = New SKYPE4COMLib.Skype

Question: Is this API still functional for this kind of procedure? How can I solve the ongoing error?

Code:

Sub testingskype()

Dim aSkype As SKYPE4COMLib.Skype
Set aSkype = New SKYPE4COMLib.Skype
Dim oChat As Chat
Dim skUser As SKYPE4COMLib.User
    Set skUser = aSkype.User("user_name")
    Set oChat = aSkype.CreateChatWith(skUser.Handle)
    oChat.OpenWindow
    oChat.SendMessage "message"

End Sub

Obs: I am using option explicit in every module I create.

like image 886
DGMS89 Avatar asked Nov 21 '17 08:11

DGMS89


People also ask

Can you use VBA to send email?

In VBA, to send emails from Excel, we can automatically automate our mailing feature to send emails to multiple users at a time. However, to do so, we need to remember that we may do it by outlook, another product of outlook, so we need to enable outlook scripting in VBA. Once done, we use the .

Is Microsoft moving away from VBA?

Microsoft is finally planning to block Visual Basic for Applications (VBA) macros by default in a variety of Office apps. The change will apply to Office files that are downloaded from the internet and include macros, so Office users will no longer be able to enable certain content with a simple click of a button.

Does Office 365 supports VBA?

You can do some really cool things in Microsoft Office with just a few lines of Visual Basic for Applications (VBA) – from creating your own custom formula in Excel to correcting branded content in PowerPoint to merging address data for a mail campaign in Word.


1 Answers

It surprised me that developers gave up on this question when the chat automation is the topic of discussion everywhere.

"Skype for Business" is basically a rebranded Lync since 2013, so it's important to understand that

Skype <> "Skype for Business"

It's like java and javascript, totally different, just similar names for branding.


It is important to understand the Skype Developer Platform or simply Skype SDK which is umbrella for Office Skype, Skype Web, Skype for Business and Skype.

Skype Developer Platform

Among all APIs/SDKs, one needs to use:

Lync 2013 SDK documentation

As this is single available SDK for Skype Desktop, Lync and all following SFB versions.

Persistent chat samples is what one should use to develop upon their solution similar to this question.

like image 116
jainashish Avatar answered Oct 01 '22 03:10

jainashish