Phone Dialer in XP

G

Guest

I'm having trouble using VBA to dial a number from an Excel Cell in XP

Prior to XP I user John Lacher's code: (updated to new folder location in XP
-C:\Program Files\Windows NT)

Sub AutoDialer()
Dim strDial As String
Dim intReturn As Integer
strDial = ActiveCell.EntireRow.Columns("B").Value
intReturn = Shell("C:\Program Files\Windows NT\Dialer.exe", 1) '\ verify
correct path
Application.SendKeys ("{F5}" & strDial & "~")

End Sub

Any Ideas on what's missing?
 
D

Don Guillett

strDial = ActiveCell.EntireRow.Columns("B").Value
try
strDial = ActiveCell
or
strDial = ActiveCell.value

OR
this maybe from a number in a cell

Sub CellToDialer() 'John Walkenbach
' Transfers active cell contents to Dialer
' And then dials the phone

' Get the phone number
CellContents = ActiveCell.Value
If CellContents = "" Then
MsgBox "Select a cell that contains a phone number."
Exit Sub
End If

' Activate (or start) Dialer
Appname = "Dialer"
AppFile = "Dialer.exe"
On Error Resume Next
AppActivate (Appname)
If Err <> 0 Then
Err = 0
TaskID = Shell(AppFile, 1)
If Err <> 0 Then MsgBox "Can't start " & AppFile
End If

' Transfer cell contents to Dialer
Application.SendKeys "%n" & CellContents, True

' Click Dial button
Application.SendKeys "%d"
' Application.SendKeys "{TAB}~", True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top