Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default What is InBufferCount?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default What is InBufferCount?

It tells you how many characters are in the buffer waiting to be read.

--
Regards,
Tom Ogilvy

wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"