1.

Solve : Microsoft VB (Word 2003)?

Answer»

I'm working with MSWord2003's vb and I was wondering how I could change a label's colour depending on how high a slider is set, 100 to deep red, 0 to green, and fade between them (50 is some kind of red/green colour).more details please.
it's VBA, by the way.

In either case you'd probably simply handle an event on the slider; LIKELY "Change".

by doing so you can use the Slider's "Value" to DETERMINE the percentage of red and green.Quote from: BC_Programmer on September 21, 2009, 12:59:30 AM

it's VBA, by the way.

In either case you'd probably simply handle an event on the slider; likely "Change".

by doing so you can use the Slider's "Value" to determine the percentage of red and green.
Manually? It's out of 100. Is there a way that uses the value to create a colour CODE?

And it's Microsoft Visual Basic. PRESS alt+f11 and see. Quote
And it's Microsoft Visual Basic. Press alt+f11 and see.

No. It isn't. It's Visual Basic for Applications.


Just because it says "Microsoft Visual Basic" in the title-bar for the Visual Basic editor doesn't mean a thing.

I, unlike you, know the history of both VB and VBA, as well as the macro languages that came before it. Visual Basic is a separate product entirely, and is part of Visual Studio, not Microsoft Office.

Quote
Manually? It's out of 100. Is there a way that uses the value to create a colour code?
yes. it's called basic arithmetic.

Combining red and green?yes. basic arithmetic.

recall the RGB function takes a Red,Green, and a blue value and returns a packed 32-bit integer, which you can use when setting the color of a control.

the idea is to MAKE the red and green based on the slider position.

assuming red is 0 and green is 100.

Code: [Select]Red = (Slider.Value/100)*255
Green = 255-Red

and then you use those two in a RGB function.




Discussion

No Comment Found