Sending Skype message through Excel VBA

minette

Board Regular
Joined
Jul 8, 2005
Messages
237
Hi all, I’m trying to send a Skype message from Excel. I've posted this on a Skype forum, but no-one could help me. I have found the following code on the Skype forum, but when I try to use it as is, I get a run-time error
“CHAT: CREATE: invalid/missing userhandle(s) as argument”
on the line
“Set oChat = aSkype.CreateChatWith(skUser.Handle)”

Sub testingskype()
Dim aSkype As Skype
Set aSkype = New SKYPE4COMLib.Skype
Dim oChat As Chat
Dim skUser As SKYPE4COMLib.User
Set skUser = aSkype.User("minette")
Set oChat = aSkype.CreateChatWith(skUser.Handle)
oChat.OpenWindow
oChat.SendMessage "hello.....testing"
End Sub

So I changed the line to
“Set oChat = aSkype.CreateChatWith(skUser.DisplayName)”
and it seems to run through it OK. However, when I check Skype, I get a blank Skype screen, and although it looks like my message was sent…..it definitely didn’t go anywhere, as there’s no name at the top. It also says "drag contact that you want to add here".

Hope someone can help me.
:)
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Is it just a wrongly dimmed variable?

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("minette")
    Set oChat = aSkype.CreateChatWith(skUser.Handle)
    oChat.OpenWindow
    oChat.SendMessage "hello.....testing"
End Sub
 
Upvote 0
That is not easy, you have benefitted from years of experience in various fields, coupled with an enquiring mind, and huge insight :)

Or in other words, I luckily noticed that difference.
 
Upvote 0
I'm extremely grateful you did, as it could've taken me DAYS to figure it out. The guys on the Skype forum couldn't even see that....

In my book, you're the best :) :)
 
Upvote 0
Hi

I have tried using this but keep getting an error and i think is related to setting the referance as outlined in one of the questions above
"Have you set a reference to a Skype dll at all? i havent' , can you tell me how to do this.

thanks
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,519
Members
448,968
Latest member
Ajax40

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top