VBA Autodialer from active cell via Ctrl-J on com-3 standard modem

wornhall

Board Regular
Joined
Feb 16, 2016
Messages
67
My modem makes successful calls using "store bought" software, but needed is VBA code to do the simple dialing. I have a spreadsheet with many phone numbers and use it throughout the day. I would rather not port the data to Access to accomplish this.

Many thanks in advance.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
So far, this is what I have developed. It needs the last couple of lines corrected. If they are run as is (without apostrophe) they actually post the phone number into the script.

Sub Dialer()
'Warren Hall Ctrl-j '11/1/2016
' Transfers active cell contents to Dialer
' Then dials the phone


Dim cellContents As String
' Get the phone number
cellContents = ActiveCell.Value
' Activate (or start) Dialer
Appname = "Dialer"
AppFile = "Dialer.exe"
On Error Resume Next
AppActivate (Appname)
TaskID = Shell(AppFile, 1)
' Send number to Dialer
'Application.SendKeys "%n" & cellContents, True
' Dial it
'Application.SendKeys "%d", True


End Sub
 
Upvote 0
I learned that in step mode, focus is given to the Visual Basic window (it figures), thus the keystrokes were sent there. When natively run, it dialed out successfully. However, subsequent attempts failed with the dialer.exe NOT receiving the phone number in the active cell of phone.xlsm.

Can you spot the problem and point me in the direction of a fix? Many thanks.
 
Upvote 0
Here is where we are at, so far. Please see the comments in the code to see the nature of this problem. The goal is to autodial from any of a list in Phone.xlsm by a mere click on a cell with a telephone number in it.

Code:
Sub Dialer() ' Ctrl-j activates    '   Warren Hall 11/19/2016
    '   Transfers active cell contents to Dialer, then dials the phone
    '   through the STANDARD modem via dialer.exe which has been configured one-time,
    '   setting the area code, 8-n-1 comm3, easy peasy stuff.
    '   PROBLEM - THIS SUB ONLY WORKS THE FIRST TIME
    '   SENDKEYS ONLY SEEMS TO WORK THE FIRST TIME
    '   A second option is to insert this formula into a column of phone.xlsm:
    '   =HYPERLINK("file:c:\windows\system32\dialer.exe","Click to call "&D128) which
    '   brings up the dialer very nicely but I can't fathom how to pipe the number]
    '   to be dialed into the app automatically.
    '   a nine line module and I can't find the problem... drat. Please HELP!
    Dim myAppID  As Integer
    Dim phoneNbr As String
    phoneNbr = ActiveCell.Value
    '   Now, activate and gain focus for Phone Dialer in normal window.
    '   the following path MAY need to be changed for your environment.
    myAppID = Shell("c:\windows\system32\Dialer.exe", 1)
    AppActivate myAppID  '   Activate Phone Dialer.
    '   Send these keystrokes to Dialer where Alt is shown as "%".
    Application.SendKeys "%n" & phoneNbr, True '   Nbr to dial + tel nr.
    Application.SendKeys "%d", True '   dial it.
    '   Hang up and exit the dialer.
    
    Application.SendKeys "%f", True '   File.
    Application.SendKeys "%x", True '   Exit.
    
    End Sub
 
Upvote 0
Taking a new approach, we now have success with:

Code:
Sub Speedial()'   Ctrl-j Warren Hall 11/21/2016, assume you have name then telephone
'   on the same row, and telephone is the active cell.
'   Lift phone, Press talk, Press Ctrl-j, Hang up, Press either space bar or enter.
    Dim Dial As String
    Dial$ = ActiveCell.Value
    Open "COM3" For Output As #1        '   change com nr as needed.
    Print #1, "ATDT" & Dial$ & Chr$(13) '   eol.
    Close #1
    MsgBox "You have called " & Dial$ & " who is " & ActiveCell.offset(0, -1)
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top