Code as I have it is:
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 = "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
Thanks!
Have you stepped through the code to see what is happening at what time?
You're ignoring errors with the "On error resume next", I'd rem that out and
run the code and see if it bombs. If it does, you'll know where the problem
lays.
Sendkeys is quirky at best, especially when going to a different OS. If you
want the function to be that portable, I'd re-write it using API to send the
messages to the appropriate windows. You could use keybd_event or
SendMessage/Postmessage to do it. Tons of examples of this on the web and in
the VB groups.
HTH
-Matt
"Bruce" <Br...@reliv4us.com> wrote in message
news:AFg0a.2339$Ec4....@rwcrnsc52.ops.asp.att.net...
The code didn't work for me either when I switched from NT 4.0 to Windows XP.
I copied the following six files from NT 4.0 to XP and it worked...
dialer.cnt
dialer.exe
dialer.FTS
dialer.GID
dialer.hlp
DIALER.INI
Regards,
Jim Cone
San Francisco, CA
jim.c...@rcn.comXXX
*****************************************************
"Bruce" <Br...@reliv4us.com> wrote in message
news:AFg0a.2339$Ec4....@rwcrnsc52.ops.asp.att.net...