Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi,
I'm a newbie here so please bear with me as I'm sure someone has already covered this topic but I can't find a thread anywhere.
In a nutshell, I want to get make a textbox to change colour dependent on what answer displayed in the box.
I've just completed the MathCAD 15 course and the instructor showed an example of this working, so I asked him how to do it. He told me it was al to do with the VB script running behind the text box and sent me the script.
When I tried to insert this into my own text box script it wouldn't work.
Adding it is not a problem (copy and paste) but the problem I’m having is trying to get the script to refer to the output of a previous calculation. I don’t quite understand how VB scripts work so I’m a bit lost as to where to add my references.
This is what I’ve tried so far….
…but when I come out of the script, I get this message…
…I’m at a bit of a loss.
Can anyone suggest anything? Or is there any possibility that someone could show a simple example of how to write this script properly please?
Any help would be greatly appreciated!
Hello Hong Thoi,
within the VB Script Editor remove the quotation marks so that it reads
If utilisation.Value < 1 Then
instead of
If utilisation.Value "<1" Then
You've compared string with integer and VB doesn't like that.
Raiko
Hi Reiko,
Thanks for your reply.
I tried removing the quotation marks as you suggested like this...
... but got a different error message instead...
any ideas? (sorry about my lack of VB knowledge, I thought this would be quite a simply script for me to start on...)
Try removing the = sign (the one after utilisation.Value) Or change it to <= rather than =<.
Alan
Write <= instead of = <
Hi guys,
I've tried swapping the < and = around like so...
... but get the originall error message when I come out of the script editor...
... I'll bet whatever I'm doing wrong must be something simple. Just dont know what it is 😞
the names of the worksheet variables are not known in the VBScript, you have to passe the variable you want to check via Input variable.
Why don't you post the sheet instead of pics?
Hi Werner,
Good idea, I should have done that right at the beginning (doh!)
here it is...
Find attached two components (with hidden arguments - use right cick) which should do what you want.
The second is a modification of a label I simply copied from Richards fine collection http://communities.ptc.com/docs/DOC-1071
Thanks Wener
Much appreciated