Results 1 to 2 of 2

Thread: Runtime Error 8005

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2008
    Posts
    1

    Runtime Error 8005

    i also hav some problem where getting the error 8005 'port already open' even though it isnt really open. here my code where it is actually to ectract data from com port

    hope u guys can help..thanx..-_-
    Code:
    Private Sub MSComm1_OnComm()
    If Worksheets("SerialPort").MSComm1.CommEvent = comEvReceive Then
    Call GetData
    End If
    
    End Sub
    Sub OpenPort()
    
    'Open the COM Port with the relevant settings
    
    Worksheets("SerialPort").MSComm1.CommPort = 1
    Worksheets("SerialPort").MSComm1.Settings = "9600,n,8,1"
    Worksheets("SerialPort").MSComm1.RThreshold = 1
    Worksheets("SerialPort").MSComm1.InBufferSize = 4096
    Worksheets("SerialPort").MSComm1.PortOpen = True
    End Sub
    
    Private Sub GetData()
    
    Dim MyData As String
    
    Wokrsheets("SerialPort").MSComm1.InputLen = 0
    
    MyData = Worksheets("SerialPort").MSComm1.Input
    ActiveCell.Value = MyData
    
    MyData = ""
    
    Worksheets("SerialPort").MSComm1.PortOpen = False
    
    End Sub
    
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Columns("A:A")) Is Nothing Then
    
    If Target.Value = "" Then
    
    Call OpenPort
    
    End If
    End If
    
    Application.EnableEvents = True
    
    End Sub
    Last edited by Hack; Aug 25th, 2008 at 07:51 AM. Reason: Added Code Tags

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