Results 1 to 2 of 2

Thread: Comm port open or closed?

  1. #1
    Guest

    Post

    How can you check the status of a comm port if it is open or closed? I thought comm1.portopen would return the status, but its not. It always returns false. The simpliest way, I just want to know if the comm port is in use or not.
    Thanks..

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923

    Post

    The PortOpen property should return the port status. e.g.

    If MSComm1.PortOpen = True Then
    MsgBox "Port is Open"
    Else
    MsgBox "Port is Closed"
    End If

    If that still doesn't work, try and open the comm port. If it is already open, it produces a trappable error, e.g.

    On Error GoTo OhDear

    MSComm1.PortOpen = True

    Exit Sub

    OhDear:
    If Err.Number = 8005 Then
    MsgBox "Port is already open!"
    Else
    MsgBox Err.Description
    End If

    Hope that helps,



    ------------------
    - Chris
    [email protected]
    Q. Why do mice have small balls?
    A. Not that many know how to dance

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width