Dialling the Phone without MSCOMM control

I often get asked the question "How can I dial a phone number from VB?". Well, you can add the MSCOMM32.OCX control to a form but that isn't necessary if you just want to dial a phone number.

Add this code to a .BAS module and call the PhoneCall sub and pass the phone number and the name of the person you want to dial as arguments.

Public Declare Function tapiRequestMakeCall Lib "TAPI32.DLL" _
(ByVal Dest As String, ByVal AppName As String, _
ByVal CalledParty As String, ByVal Comment As String) As LongPublic Sub PhoneCall(sNumber As String, sName As String)
Dim lRetVal As Long
lRetVal = tapiRequestMakeCall(Trim$(sNumber), App.Title, 
Trim$(sName), "")
If lRetVal <> 0 Then
'Couldn't make the call.
'Take appropriate action
End If
End Sub


Wood Blinds | Help with Window Blinds | Yahoo Dating | HP Projectors | Vertical Blinds