Outlook 2013, VBA: initiating a skype call

Is there a way to initiate a Skype call via vba code from Outlook? The idea is to pass a phonenumber from an Outlook contact item to Skype phone.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michael FowlerSolutions ConsultantCommented:
Have a look at this previous answer


Dim skpSkype As SKYPE4COMLib.Skype
Dim calCall As SKYPE4COMLib.Call

Set skpSkype = New SKYPE4COMLib.Skype
Set calCall = skpSkype.PlaceCall(Phone_Number.Text)

Open in new window

KKressAuthor Commented:
Michael74, what do I Need to do to make this code work? I set a reference to Skype4COM 1.0 Type Library, but that didn't do the Job. What am I missing? Or do I require different code for Outlook? I have the understanding that Outlook VBA and ACCESS VBA are quite different?
David LeeCommented:
Hi, KKress.

If you're using the code exactly as @Michael74 posted it, then "no" it won't work in Outlook.  How do you want this to work?  Do you want to select a contact and initiate a call to one of the numbers in that contact or do you want to enter a number to call?  If it's the former, then which number do you want to call or do you want to be prompted to select the number to call?
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

KKressAuthor Commented:
Hi BlueDevilFan,

actually it should work just like the call Feature of exchange. With Exchange one can select a contact, right click and and select a number to be called. Unfortunatelly this Feature requires a rather expensive Exchange plan 4. So the idea is to offer the exact same sort of functionality but not initiate a lync call, but pass the selected Telefone number to Skype. Essentially I'm using the commandline call to Skype as a Workaround. But I thought there might be a direct way to call Skype.
David LeeCommented:
With Exchange one can select a contact, right click and and select a number to be called.

I'm not aware of any way to accomplish that with VBA.  There's no means I know of to implement the right-click functionality.  The best I can do is to select a contact, then display a prompt asking which number you want to dial.  Here's a macro that does this.  It assumes that @Michael74's code works since I'm not in a position to test this.

Sub DialContact()
    Dim olkCon As Object, _
        skpSkype As Object, _
        calCall As Object, _
        strBuf As String, _
        strSel As String, _
        strNum As String
    Select Case TypeName(Application.ActiveWindow)
        Case "Explorer"
            Set olkCon = Application.ActiveExplorer.Selection(1)
        Case "Inspector"
            Set olkCon = Application.ActiveInspector.CurrentItem
    End Select
    If olkCon.Class = olContact Then
        strBuf = "Enter the number corresponding to the number you want to call" & vbCrLf & vbCrLf & _
                 "1 - Work: " & olkCon.BusinessTelephoneNumber & vbCrLf & _
                 "2 - Home: " & olkCon.HomeTelephoneNumber & vbCrLf & _
                 "3 - Mobile: " & olkCon.MobileTelephoneNumber
        strSel = InputBox(strBuf, "Select Number")
        If Len(strSel) > 0 Then
            If IsNumeric(strSel) Then
                Select Case CInt(strSel)
                    Case 1
                        strNum = olkCon.BusinessTelephoneNumber
                    Case 2
                        strNum = olkCon.HomeTelephoneNumber
                    Case 3
                        strNum = olkCon.MobileTelephoneNumber
                    Case Else
                        strNum = ""
                End Select
                If strNum >= "" Then
                    Set skpSkype = New SKYPE4COMLib.Skype
                    Set calCall = skpSkype.PlaceCall(strNum)
                End If
            End If
        End If
    End If
    Set olkCon = Nothing
    Set skpSkype = Nothing
    Set calCall = Nothing
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KKressAuthor Commented:
@BlueDevilFan: Looks all pretty straightforward. Nevertheless, I can't get it to work, and I have no clue, what I'm doing wrong. So using your code I receive an runtime error 429 (ActiveX componentcan't create object) at Statement "Set skpSkype = New SKYPE4COMLib.Skype". I have referenced skype4comlib, it is available in the vba Editor and Shows all available properties and methods, but it doesn't want to create this object. Any ideas?
David LeeCommented:

I'm not in a position to test the Skype specific portion of the code.  In the VB editor, if you type out

Set skpSkype = New SKYPE4COMLib.

Open in new window

what appears in the list of items that pops up as soon as you hit the period?
KKressAuthor Commented:
@BlueDevilFan: The error message is: Run-Time-Error 429: ActiveX component can't create object
KKressAuthor Commented:
@BlueDevilFan: I just reviewed this Topic to see whether I have to Close it. I realized that I obviously have given you an answer to your last question which was inappropriate. So let me give it another try. So here is the Pop-Up list when I type the satement set skpSkype = New SKAPE4COMlib.
(see attachment).
Martin LissOlder than dirtCommented:
I've requested that this question be deleted for the following reason:

The question has either no comments or not enough useful information to be called an "answer".
KKressAuthor Commented:
I'm pretty sure that I have a different additional issue, that has nothing to do with the original question. So I have to assume that the question is answered ans I'll post the additional issue as a seperate question.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.