by Mahesh Vaghasiya (4 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Fri 24th June 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)
here is the small code for dialing a number using a modem.
Screen.MousePointer = vbHourglass
DoEvents
On Error GoTo Oops
' Try to give MSComm1 time to close.
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
DoEvents
' Set the comm port number.
MSComm1.CommPort = tellComm
' Read the entire buffer when Input is used.
MSComm1.InputLen = 0
'9600 baud, no parity, 8 data bits, 1 stop bit.
MSComm1.Settings = "9600,N,8,1"
' Open the comm port.
MSComm1.PortOpen = True
Timer1.Enabled = True
' Send the attention string to the modem.
MSComm1.Output = "ATV1Q0" & Chr$(13)
MSComm1.Output = "AT&C1&D2" & Chr(13)
DoEvents: DoEvents
MSComm1.Output = "ATDT" & text1.text & ";" & Chr(13)
'Call checkmodem
Screen.MousePointer = vbDefault
Exit Sub
Oops:
MsgBox "Error " & Err.Number & vbCrLf & _
Err.Description, _
vbExclamation Or vbOKOnly, _
"Error"
Screen.MousePointer = vbDefault
Exit Sub
End Sub