Start » VBA-Ejemplos » Marcar el teléfono desde Excel

Marcar el teléfono desde Excel

José Skraviuk | 1/11/2005

Resumen

Si tu pc está equipado con módem podrás realizar llamadas desde Excel, teniendo el número en una lista. A través de una API (instrucción Windows) podemos hacer que Excel arranque el Marcador Telefónico. Para usar tienes que marcar la celda con el nº, y luego dar marcar.

marcador2

marcador

Configuraciones

Hay una parte del código, que se puede configurar, por si alguien quiere llamar desde un lugar donde se trabaja con una central telefonica. Generalmente para tomar una linea te pide que marques el (0).

PhoneCall "0" + strNumero, strNombre

Si tienes linea directa, debes quitar el "0".

PhoneCall strNumero, strNombre

El código

'Jose Skraviuk
'ayudaexcel {at} yahoo.com.ar

Option Explicit
Private Declare Function tapiRequestMakeCall _
Lib "TAPI32.DLL" _
(ByVal Dest As String, _
ByVal AppName As String, _
ByVal CalledParty As String, _
ByVal Comment As String) As Long

Private Sub PhoneCall(sNumber As String, sName As String)
Dim lRetVal As Long
lRetVal = tapiRequestMakeCall(Trim$(sNumber), _
"Marcando", Trim$(sName), "")
If lRetVal <> 0 Then
End If
End Sub

Public Sub MarcarTelefono()
Dim strNumero As String
Dim strNombre As String
strNombre = ActiveCell.Value
strNumero = ActiveCell.Offset(0, 1).Value

PhoneCall "0" + strNumero, strNombre

End Sub