Results 1 to 3 of 3

Thread: Dial phone numbers from Excel file

  1. #1
    Join Date
    Dec 2008
    Posts
    165

    Dial phone numbers from Excel file

    Hello friends,

    I have found a very interesting tip for you.I know that many people store there contacts in excel file and where ever you wan to make a call, you need to open the file and dial the number.But guess if you can directly make a call when you open up your excel file for this thing to happen you need to use this code.

    For that you need to set a reference to the Microsoft Comm Control 6.0 through Tools, References before it will work. You will have to play with the code to make it work for you.


    Code:
    Dim CancelFlag As Integer
    
    Private Sub cmdStop_Click()
    CancelFlag = 1
    End Sub
    
    Private Sub Worksheet_Activate()
    'Setting InputLen to 0 tells MSComm to read the entire contents of the
    'input buffer when the Input property is used.
    
    MSComm1.InputLen = 0
    End Sub
    
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
    Dim Number As String
    
    ' Get the number to dial.
    Number = Target.Value
    If Number = "" Then Exit Sub
    
    ' Dial the selected phone number.
    Dial (Number)
    
    End Sub
    
    Private Sub Dial(Number)
    Dim DialString As String
    Dim FromModem As String
    Dim dummy As Integer
    
    ' AT is the Hayes compatible ATTENTION command and is required to send commands to the modem.
    ' DT means "Dial Tone." The Dial command uses touch tones, as opposed to pulse (DP = Dial Pulse).
    ' Numbers is the phone number being dialed.
    ' A semicolon tells the modem to return to command mode after dialing (important).
    ' A carriage return, vbCr, is required when sending commands to the modem.
    DialString = "ATDT" + Number + ";" + vbCr
    
    ' Communications port settings.
    ' Assuming that a mouse is attached to COM1, CommPort is set to 2
    MSComm1.CommPort = 1
    MSComm1.Settings = "9600,N,8,1"
    
    ' Open the communications port.
    On Error Resume Next
    MSComm1.PortOpen = True
    If Err Then
    MsgBox "COM1: not available. Change the CommPort property to another port."
    Exit Sub
    End If
    
    ' Flush the input buffer.
    MSComm1.InBufferCount = 0
    
    ' Dial the number.
    MSComm1.Output = DialString
    
    ' Wait for "OK" to come back from the modem.
    Do
    dummy = DoEvents()
    ' If there is data in the buffer, then read it.
    If MSComm1.InBufferCount Then
    FromModem = FromModem + MSComm1.Input
    ' Check for "OK".
    If InStr(FromModem, "OK") Then
    ' Notify the user to pick up the phone.
    Beep
    MsgBox "Please pick up the phone and either press Enter or click OK"
    Exit Do
    End If
    End If
    
    ' Did the user choose Cancel?
    If CancelFlag Then
    CancelFlag = False
    Exit Do
    End If
    Loop
    
    ' Disconnect the modem.
    MSComm1.Output = "ATH" + vbCr
    
    ' Close the port.
    MSComm1.PortOpen = False
    End Sub

  2. #2
    Join Date
    Dec 2008
    Posts
    75

    Re: Dial phone numbers from Excel file

    It's an Awesome tip i was really got frustrated with my contact which i used to store in excel by using your above code i am very happy.

  3. #3
    Join Date
    Dec 2008
    Posts
    101

    Re: Dial phone numbers from Excel file

    It's a very nice trick which you have made,i have also find another solution for it.If you don't want to use the above code you can directly download the software and can make calls.For downloading click here

Similar Threads

  1. What E Value Stands for between numbers in Excel
    By M.N.S in forum MS Office Support
    Replies: 4
    Last Post: 21-02-2012, 05:09 PM
  2. How to change negative numbers to positive numbers in Excel
    By Shaina Na in forum Microsoft Project
    Replies: 3
    Last Post: 08-01-2012, 05:35 PM
  3. Unable to dial certain numbers in Skype
    By jAYASENA in forum Technology & Internet
    Replies: 6
    Last Post: 21-06-2011, 10:26 AM
  4. How to sum numbers with certain criteria in Excel
    By Laalamani in forum Windows Software
    Replies: 5
    Last Post: 23-10-2010, 02:31 PM
  5. How to block phone numbers on AT&T cell phone
    By DwinHell in forum Portable Devices
    Replies: 2
    Last Post: 20-06-2009, 09:38 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,320,832.00589 seconds with 16 queries