What is InBufferCount?

G

Guest

Can someone explain what is InBufferCount? I am trying to
dignose code on some machines that continue at the loop.

Public Function GetWeight() As Double
Dim sInput As String

On Error GoTo ErrorHandler

ActiveCell.Value = "Waiting for Stable..."
frmComm.comExcel.CommPort = 1
frmComm.comExcel.Settings = "9600,N,7,2"
frmComm.comExcel.PortOpen = True
frmComm.comExcel.Output = "1S" & Chr$(13) 'Print on
stable
frmComm.comExcel.Output = "P" & Chr$(13) 'Display data

Do
DoEvents
Loop Until frmComm.comExcel.InBufferCount >= 18

sInput = frmComm.comExcel.Input
frmComm.comExcel.PortOpen = False

GetWeight = Val(Mid$(sInput, 1))

Exit Function

ErrorHandler:
If Err.Number = 8005 Then
Exit Function
Else
MsgBox Err.Description
End If
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Help with MSCOMM control 0
MSComm locking up Excel 1

Top