conditional formmating along with vba code

martin461

New member
Local time
Today, 08:34
Joined
Jul 29, 2009
Messages
9
Hi,
I have a form that has a few texts boxes that have conditional formmating on them. When check boxes are ticked certain text boxes are hightlighted using the conditional formmating. The problem I have now is that I want write code that records which text boxes are highlighted. I have tried writing events like

text1.fontBold = true
text1.fontItalic = false

etc etc...

But it appears the vba code ignores what ever conditions have taken place within the conditional formmating. Can any one help with this
 
Not at all sure exactly what you're trying to do here, but

text1.fontBold

is not going to be True simply because CF has set it to bold. It's only set to display that way for a given record that meets certain criteria. fontBold is a property of the textbox, for all instances of the textbox.

In order to get the state of the font for a textbox in a given record, you're going to have to use the same condition that was used to set the formatting. So if the textbox font is Bold if its value is > 100, instead of using

If text1.fontBold = True Then

you'd use

If text1.Value > 100 Then

or simply

If text1 > 100 Then
 

Users who are viewing this thread

Back
Top Bottom