Textbox Problem

  • Thread starter Thread starter toocold
  • Start date Start date
T

toocold

Good afternoon everyone,

Quick question. I have a userform that has several textboxes. When
am in Visual Basic and using the properties window, I can change th
SpecialEffect property. i.e. sunken, flat, etc.

What I am wondering is can I change this property using VBA for th
textbox?

Any ideas are appreciated.
Thanks,
d
 
With Me.TextBox1
.SpecialEffect = fmSpecialEffectSunken
End With


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Thanks Bob, exactly what I was looking for.

One more question.

I have a series of textboxes. Textbox1 through Textbox12. For eac
textbox, I want to test something to see if it is true. I am going t
use a if then statement. But what I was wondering is can a perso
somehow identify the textbox using a variable. I don't want to hav
the same code repeated for each textbox.

ie. Could I somehow do something like

Dim xcount as integer

xcount = 12

Do while xcount > 0

'unspecified code if statement
textbox(xcount).value = something.

loop

Just curious. This would help me simplify the work greatly. An
ideas?
Cheers,
d
 
Dim ctl As Control
For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Then
MsgBox ctl.Name
End If
Next ctl

is one way of getting at all textboxes in a loop

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top