Dynamic update of UserForm TextBox

  • Thread starter Thread starter Tom_C
  • Start date Start date
T

Tom_C

I am having a problems getting a texbox on a userform to updat
dynamcally (updated without user interaction). I am gettin
measurements which are changing continuously and would like to monito
them in real time. I can see the values by using a DDERequest, but
must always click something to get an update. Or I can put th
following (=SIPART|'DR24'!SAA6) in an Excel cell and it will monito
the signal in real time, but I cannot get this to update in th
textbox. Using the ControlSource of the text box would work, but i
overwrites the code (=SIPART|'DR24'!SAA6) in the referenced cell.

Can any one help?

Thank you
 
Tom,

I think you need some event to update the textbox, just changing the
ControlSource may not be enough. I don't know what code you are using to
write to the spreadsheet, but could this not be directed to the textbox at
this point? If not, perhaps worksheet event code would do it, that is write
to AA6 and trap that change of AA^ to write to the textbox.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Bob,

Thank you for your quick response. What I have is a DDE Server pickin
up measurements from the COM port. With this formul
(=SIPART|'DR24'!SAA8) in cell "A1" I can continuously monito
measurements. SIPART being the application (server) and DR24 the ite
and SAA8 the point name (SAA8 means serial analog output #8).

With the TextBox1 (below) I can get one update from cell "A1" into m
userform everytime I press the backspace. (and of course I am in th
textbox). I would like the textbox to update continuouly without m
interaction. There could be of course a button that starts continuou
monitoring and stops it.

Private Sub TextBox1_Change()
TextBox1.Value = Worksheets("Sheet1").Range("A1")
End Sub

Thanks.

To
 
Tom,

Haven't monitored a serial port myself, but you could try this.

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$A$1" Then
UserForm1.TextBox1.Text = Target.Value
End If

End Sub

Add it to sheet1 code module.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Bob,

It didn't work unfortunately. I think it is because the actual content
of the cell did not change. I mean the (=SIPART|'DR24'!SAA8) is always
the same. I added another textbox to the form that sent a value to cell
A1. It then came back into textbox1. Do you get what I mean?

I can also get values directly in my userform with the DDERequest
command. Again I have the continuous and automatic update problem.
Isn't there any kind of looping that would send this command every
second or 0.5 seconds without locking up other controls on the same
userform?

Thanks again for you interest.

Tom
 
Tom,

Take a look at the OnTime method in help. With this you can schedule forward
a macro to run. So you could set it to run in 5 secs, and when it runs, you
could do your thing, then schedule it to run again in another 5 secs.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Bob,

Thanks a million! Now I got it to work. Now I can go have a beer. I
you are ever in Finland, let me know. I owe you a beer!

Thanks again!

To
 
Back
Top