change the color of a textarea into red but it becomes black

thirty

Registered User.
Local time
Today, 20:27
Joined
Dec 10, 2012
Messages
10
Hello,

I want to change the color of the background from a textarea txtTitel.
I want to change it into the color red, but i get always the color black.
The forecolor doesn't change.
I use the following rules:

lngWhite = RGB(255, 255, 255)
lngRed = RGB(255, 0, 0)
lngYellow = RGB(255, 255, 0)


Exit Sub
err_fout:
MsgBox Err.Description & " - " & Err.Number
If Err.Number = 94 Then
Me.txtTitel.BackColor = lngRed
Me.txtTitel.ForeColor = lngYellow

MsgBox "Vul het tekstvak Titel van de drager in", vbOKOnly + vbInformation, strTitel
Me.txtNote = "Geen foto beschikbaar"
End If

The red lines of code says "change the backcolor into red.
But i get always the color black

What kind of a error made i?
 
hmmm, I wonder if this is a localization problem?

Are you running english OS and Office?
?Is your system delimiter a comma or a period?

Does your msgbox fire?

Have you tried changing the numbers to achieve different colors for testing purposes?
 
I am running dutch OS and Office.
My system delimiter a comma.

I tried olso green and blue.
The textarea backcolor stays black
 
Have you tried using the built in VBA color constants (vbRed, vbYellow, etc)?

Me.txtTitel.BackColor = vbRed
Me.txtTitel.ForeColor = vbYellow
 
Thanks,

It is working with the buikd in VBA color constants
 
Are you using Option Explicit?

If lngRed is setting to Black then lngRed may be an undeclared Variant which will have a value of zero(0) which is Black.

Check the value of lngRed just before using it.

Chris.
 
Chris,

I use the Option Explicit.
I erased that option.
lngRed = 255

Now i am using my program without the Option Explicit.
I have a question. Why do they use the Option Explicit?
 
Thirty.

Place the cursor on the word Explicit and press the F1 key.

If it works with vbRed and lngRed = 255 then it should work with lngRed.

Chris.
 
Chris,

Thank you for the quick response.

All problems are solved.

Thirty
 

Users who are viewing this thread

Back
Top Bottom