Question : MSCom1 control returns objectrequired - what am I doing wrong?

I have taken this code straight of MS website but when it gets to  MSComm1.CommPort = 15 I get an error "Object required".  I have not been able to find the control in the active X or controls list
Help please!!


 ' Buffer to hold input string
   Dim Instring As String
   ' Use COM1.
   MSComm1.CommPort = 15
   ' 9600 baud, no parity, 8 data, and 1 stop bit.
   MSComm1.Settings = "9600,N,8,1"
   ' Tell the control to read entire buffer when Input
   ' is used.
   MSComm1.InputLen = 0
   ' Open the port.
   MSComm1.PortOpen = True
   ' Send the attention command to the modem.
   'MSComm1.Output = "ATV1Q0" & Chr$(13) ' Ensure that
   ' the modem responds with "OK".
   ' Wait for data to come back to the serial port.
    If MSComm1.CommEvent = comEvReceive Then
    COM_Read = frmMain.MSComm1.Input
    End If
   
   
   Do
    DoEvents
   Buffer$ = Buffer$ & MSComm1.Input
   Loop Until InStr(Buffer$, "OK" & vbCrLf)
   ' Read the "OK" response data in the serial port.
   ' Close the serial port.
   MSComm1.PortOpen = False
End Sub

Answer : MSCom1 control returns objectrequired - what am I doing wrong?

Open the Toolbox in form design.
Click the 'More controls' icon (Hammer/Wrench with 3 dots)
Scroll down and select the Microsoft Communication Control.
Drag it on your form
Name it (or keep the default name)
Use the name in your code.


Scott C
Random Solutions  
 
programming4us programming4us