Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Application.SendKeys "%n" & CellContents, True
The above part of the following code does not function in WindowsXP, why Microsoft makes it so difficult to use this feature is beyond me. It works fine on another computer running WindowsME. Private Sub TestDialer_Click() ' 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" AppFile = "C:\Windows\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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think the reason why SendKeys doesn't work inWindows XP is that it could
be used to circumvent security. My guess is that it will work if you toggle your security settings in either Excel or Windows. Start with Excel. /Fredrik "Pat" wrote in message ... Application.SendKeys "%n" & CellContents, True The above part of the following code does not function in WindowsXP, why Microsoft makes it so difficult to use this feature is beyond me. It works fine on another computer running WindowsME. Private Sub TestDialer_Click() ' 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" AppFile = "C:\Windows\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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It might also be that another process is "stealing" the focus between your
AppActivate and your SendKeys. I have found SendKeys to be potentially dangerous for this reason unless used in a very controlled environment (Example: I have had Groupwise notifications pop up during a routine using SendKeys - because the alert steals the focus, my SendKeys operate on the Groupwise dialog instead of the window I meant for them to be directed to). "Pat" wrote: Application.SendKeys "%n" & CellContents, True The above part of the following code does not function in WindowsXP, why Microsoft makes it so difficult to use this feature is beyond me. It works fine on another computer running WindowsME. Private Sub TestDialer_Click() ' 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" AppFile = "C:\Windows\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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
So frustrated! Please help! | Excel Discussion (Misc queries) | |||
Frustrated | New Users to Excel | |||
Frustrated Cook | Excel Worksheet Functions | |||
Frustrated - List Box | Excel Programming | |||
Frustrated with Factorials | Excel Programming |