Thread: Phone Dialer
View Single Post
  #1   Report Post  
Pat
 
Posts: n/a
Default Phone Dialer

The following code to phone an number via the dialer is not working
correctly:

Private Sub CommandButton1_Click()
'Sub CellToDialer() 'John Walkenbach
' Transfers active cell contents to Dialer
' And then dials the phone
' Modified by Jim Cone on Jan 18, 2002


Dim CellContents As String 'JBC
Dim AppName As String 'JBC
Dim AppFile As String 'JBC
Dim TaskID As Variant 'JBC


' Get the phone number
CellContents = ActiveCell.Value
If CellContents = "" Then
MsgBox "Select a cell that contains a phone number.", _
vbInformation 'JBC
Exit Sub
End If
' Activate (or start) Dialer
AppName = "C:\Windows\ServicePackFiles\i386"
'AppName = "Dialer"
' USE THE FULL FILE PATH APPLICABLE TO YOUR OPERATING SYSTEM 'JBC


AppFile = "C:\Program Files\Windows NT\dialer.exe" 'JBC
On Error Resume Next
' This activates the dialer if it showing on the desktop 'JBC
AppActivate (AppName)
If Err.Number < 0 Then
Err = 0
' This activates the dialer by opening(running) the file 'JBC
TaskID = Shell(AppFile, vbNormalFocus)
If Err < 0 Then
MsgBox "Can't start " & AppFile, vbExclamation 'JBC
Exit Sub 'JBC
End If 'JBC
End If

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


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


' Selects the next telephone number in the column. 'JBC
ActiveCell(2, 1).Select 'JBC
' The macro button must now be clicked twice to dial the next 'JBC
' number in the column.
End Sub

I have entered the AppName = "C:\Windows\ServicePackFiles\i386" as the full
path name is this correct? I am using Office 2003 running on Windows

The Phone Dialer window opens but the number does not dial. I have made a
phone call directly in Phone Dialer without difficulty.

Another thing that puzzles me is when an number is highlighted in excel and
the code is run a copy of the phone number is entered into the cell
immediately below.


Anyone know what is happening here?
Thanks
Pat