Re: A HELP BOX
- From: "Greg Maxey" <gmaxey@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 12 Sep 2008 23:24:07 -0400
Thinking it might be past Jay's bedtime I will step in. Something like this
maybe:
lblDescriptive is the name of the descriptive label placed near the textbox.
Private Sub UserForm_Initialize()
With Me.lblDescriptive
.Visible = False
.Caption = ""
.ForeColor = &H80000012
End With
End Sub
'Show the decriptive label on entry to the text field.
Private Sub TextBox1_Enter()
With Me.lblDescriptive
.Visible = True
.Caption = "Enter your name in this format: ""First name, CtrlTab twice,
your Middle Initial, CtrlTab once, Last Name"""
.ForeColor = wdColorBlue
End With
End Sub
'Validate the entry on exit
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With Me.TextBox1
If Not .Text Like "[A-Z]*" & vbTab & vbTab & "[A-Z]" & vbTab & "[A-Z]*" Then
Cancel = True
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
With Me.lblDescriptive
.Caption = "Wrong format!! Enter your name in this format: ""First
name, CtrlTab twice, your Middle Initial, CtrlTab once, Last Name"""
.ForeColor = wdColorRed
End With
End If
End With
End Sub
'Restore label when user begins correction.
Private Sub TextBox1_Change()
With Me.lblDescriptive
.Visible = True
.Caption = "Enter your name in this format: ""First name, CtrlTab twice,
your Middle Initial, CtrlTab once, Last Name"""
.ForeColor = wdColorBlue
End With
End Sub
LEU wrote:
How would you write it?
"Jay Freedman" wrote:
You could do that. I had assumed that the label would be visible
initially when the userform appears, not that it would be made
visible on entering the text box. But if you want to do that,
certainly you could put a statement into the text box's _Enter()
procedure to set the label's .Visible property to True.
Try it, see how it looks to you.
On Fri, 12 Sep 2008 16:41:01 -0700, LEU
<LEU@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I'm not sure what you are saying. Are you saying that when I would
enter the textbox a label box would show up that would display the
correct format and then when I would leave the text box the
labelbox would turn invisible?
"Jay Freedman" wrote:
The simplest solution for a userform is to put the instructions
into a label directly on the userform surface. If you want to get
fancy, the _Exit() procedure of the text box could set the label's
.Visible property to False when the user leaves the box; and it
could also validate the user's entry and set the Cancel argument
to False so they can't exit until the format is correct.
On Fri, 12 Sep 2008 14:41:00 -0700, LEU
<LEU@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
It's a userform. Document control wants it that way for
appearance.
LEU
"Jay Freedman" wrote:
On Fri, 12 Sep 2008 12:35:01 -0700, LEU
<LEU@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I have a form that opens from a document. When you go to enter
your name, it needs to be in a set format. Is there a way that
when I'm in the name textbox a help or information balloon
opens with the following : "Enter your First name, CtrlTab
twice, your Middle Initial, CtrlTab once, Last Name" and then
closes when they go to the next box?
What kind of "form" are we talking about here? A protected
document, containing
form fields? An unprotected document containing a table
(guessing because of the
CtrlTab)? A userform? The answer is different for each of these.
Also, it may be possible to avoid the need for an instruction
popup by designing
the form properly. What "properly" means depends on how you're
going to use the
completed document -- why do you need this specific format?
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
--
Greg Maxey - Word MVP
My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org
McCain/Palin '08 !!!
.
- References:
- A HELP BOX
- From: LEU
- Re: A HELP BOX
- From: Jay Freedman
- Re: A HELP BOX
- From: LEU
- Re: A HELP BOX
- From: Jay Freedman
- Re: A HELP BOX
- From: LEU
- Re: A HELP BOX
- From: Jay Freedman
- Re: A HELP BOX
- From: LEU
- A HELP BOX
- Prev by Date: Re: A HELP BOX
- Next by Date: Autosave problem
- Previous by thread: Re: A HELP BOX
- Next by thread: Re: A HELP BOX
- Index(es):
Relevant Pages
|