G
gtslabs
I have some code that uses a form to start acquiring data from a
serial port using using netcomm1.ocx which is similar to mscomm1.ocx.
It is putting the live data into an excel cell. So essentiall I have a
meter in a cell reading the output from a data aquistion system.
I have it being called from a form becuase that is how I added the
activex netcomm1.ocx.
I really dont want to start from a form and would like to have command
buttons on the sheet.
How can I do that?
My second question is that I want to stream this data live to a cell
and have it updated at a certain frequency. Using the form code to
start this process I need a way to have a user stop the live stream.
I wanted a msgbox to be hit to stop the data. So I tried to code
below a loop that would keep updatind the cells with live data while
the ok button was not depressed.
It did not work. Any idea on what I need to fix here?
Response = 0
Do While Response <> 1
Response = MsgBox("Click Yes to Stop the live data stream",
vbOKOnly + vbDefaultButton1, "Stop Live Data")
Buffer$ = ""
NETComm1.Output = "CALL 5" & Chr(13) ' retrieve reading
from Serial Device
Buffer$ = Buffer$ & NETComm1.InputData
Cells(6, 1) = Application.Clean(Buffer$)
TimedDelay (0.1)
Buffer$ = ""
NETComm1.Output = "CALL 6" & Chr(13) ' retrieve reading
from Serial Device
Buffer$ = Buffer$ & NETComm1.InputData
Cells(6, 2) = Application.Clean(Buffer$)
TimedDelay (0.1)
Loop
Thanks
serial port using using netcomm1.ocx which is similar to mscomm1.ocx.
It is putting the live data into an excel cell. So essentiall I have a
meter in a cell reading the output from a data aquistion system.
I have it being called from a form becuase that is how I added the
activex netcomm1.ocx.
I really dont want to start from a form and would like to have command
buttons on the sheet.
How can I do that?
My second question is that I want to stream this data live to a cell
and have it updated at a certain frequency. Using the form code to
start this process I need a way to have a user stop the live stream.
I wanted a msgbox to be hit to stop the data. So I tried to code
below a loop that would keep updatind the cells with live data while
the ok button was not depressed.
It did not work. Any idea on what I need to fix here?
Response = 0
Do While Response <> 1
Response = MsgBox("Click Yes to Stop the live data stream",
vbOKOnly + vbDefaultButton1, "Stop Live Data")
Buffer$ = ""
NETComm1.Output = "CALL 5" & Chr(13) ' retrieve reading
from Serial Device
Buffer$ = Buffer$ & NETComm1.InputData
Cells(6, 1) = Application.Clean(Buffer$)
TimedDelay (0.1)
Buffer$ = ""
NETComm1.Output = "CALL 6" & Chr(13) ' retrieve reading
from Serial Device
Buffer$ = Buffer$ & NETComm1.InputData
Cells(6, 2) = Application.Clean(Buffer$)
TimedDelay (0.1)
Loop
Thanks