Phone Dialer

P

Pat

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
 
J

Jim Cone

Pat,

The code only worked for me on older versions of phone dialer.
I had to copy all the phone dialer files from Windows NT4 into XP
(in a separate folder) to get it to work.

Regards,
Jim Cone (JBC)
San Francisco, USA
 
P

Pat

Hi Jim,

It also worked for me in WndowsME, I presume if I copy all of the phone
dialer files from there into WinXP it will work?

It puzzles me why microsoft make it so dammed difficult for the user by
messing with this a feature.

Regards
Pat
 
J

Jim Cone

Hello Pat,

The files I copied were...

dialer.cnt
dialer.exe
dialer.fts
dialer.gid
dialer.hlp
dialer.ini

All of them were probably not required.
I am not familiar with WindowsMe and have not messed with
the code for a long time, so post back if you give it a try.

Regards,
Jim Cone
San Francisco, USA

Pat said:
Hi Jim,

It also worked for me in WndowsME, I presume if I copy all of the phone
dialer files from there into WinXP it will work?
It puzzles me why microsoft make it so dammed difficult for the user by
messing with this a feature.
Regards
Pat

- snip -
 
P

Pat

Hi Jim,

I copied the files and run the code. The dialer loaded ok but excel did not
fill in the phone number. I have tried entering the phone number directly
and the dialer dials the number ok.

The code I am using is as follows:

Private Sub CommandButton1_Click()
' Transfers active cell contents to Dialer
' And then dials the phone

' Get the phone number
' mc = Application.Choose(ActiveCell.Column, 4, 3, 2, 1, 0)
'ActiveCell.Offset(0, mc).Select
CellContents = Cells(ActiveCell.Row, "AB").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

You will see I have modified the code slightly in the past.
Pat
 
J

Jim Cone

Pat,

If all else fails read the directions <g>

'Below is my current version of the code.
'NOTE: "AppFile" uses the full file path.
'I just dialed "Time" without a problem.

'Jim Cone

'---------------------------------------------
Sub CellToDialer() 'John Walkenbach
' Transfers active cell contents to Dialer
' And then dials the phone
' Modified by Jim Cone on Jan 18, 2002
' Changed AppFile path on Apr 19, 2003

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

' Get the phone number
CellContents = ActiveCell.Value
If Len(CellContents) < 7 Then
MsgBox "Select a cell that contains a phone number.", _
vbInformation
Exit Sub
End If
' Activate (or start) Dialer
AppName = "Dialer"
' USE THE FULL FILE PATH
' AppFile = "C:\Program Files\Windows NT\dialer.exe"
AppFile = "C:\Old Telephone Dialer\dialer.exe"
On Error Resume Next
' This activates the dialer if it is showing on the desktop
AppActivate (AppName)
If Err.Number <> 0 Then
Err = 0
' This activates the dialer by opening(running) the file
TaskID = Shell(AppFile, vbNormalFocus)
If Err <> 0 Then
MsgBox "Can't start " & AppFile, vbExclamation
Exit Sub
End If
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.
ActiveCell(2, 1).Select
' The macro button must now be clicked twice to dial the next
' number in the column.
End Sub
'--------------------------------------------------------------------


Pat said:
Hi Jim,

I copied the files and run the code. The dialer loaded ok but excel did not
fill in the phone number. I have tried entering the phone number directly
and the dialer dials the number ok.

The code I am using is as follows:

Private Sub CommandButton1_Click()
' Transfers active cell contents to Dialer
' And then dials the phone

' Get the phone number
' mc = Application.Choose(ActiveCell.Column, 4, 3, 2, 1, 0)
'ActiveCell.Offset(0, mc).Select
CellContents = Cells(ActiveCell.Row, "AB").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

You will see I have modified the code slightly in the past.
Pat

- snip -
 

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