Autotab in Word with macro ?

Autotab in Word with macro ?

Post by Ann » Tue, 27 Jul 2004 22:06:21


I wanne to ask my question again

Hello,

I created a form in MS Word.
When I reached the maximumlength in a field I wanted to go automatically to
the next field.
I think I can do it with a macro but I can't create a macro like that.

Can anyone help me?

Ann
 
 
 

Autotab in Word with macro ?

Post by Lee Hanke » Sun, 01 Aug 2004 00:19:28


You can do this if your fields are TextBoxes created with the
Control Toolbox toolbar and clicking on the TextBox icon.
In Design Mode, right click on your first textbox
and choose View Code. In the Visual Basic Editor from the pull
down list at the top right choose KeyPress. In between the words
'Private Sub...' and 'End Sub' paste in the following code.

If Len(TextBox1) = TextBox1.MaxLength - 1 Then
TextBox1 = TextBox1 + Chr$(KeyAscii)
TextBox2.Select
End If

You may call the textboxes whatever you like, TextBox1 for the first
and TextBox2 for the second are just examples. You change their name
by right clicking on the textbox while in Design Mode and choosing
Properties and editing the (Name) entry.

Similarly you need to change the MaxLength entry to be however many
characters you want to allow in the textbox.


--
Posted via Mailgate.ORG Server - http://www.yqcomputer.com/

 
 
 

Autotab in Word with macro ?

Post by Ann » Wed, 11 Aug 2004 15:55:05

Thanks for the information.
I've tried to do it but - no, it didn't work.

Ann



"Lee Hanken" < XXXX@XXXXX.COM > schreef in bericht




to


You can do this if your fields are TextBoxes created with the
Control Toolbox toolbar and clicking on the TextBox icon.
In Design Mode, right click on your first textbox
and choose View Code. In the Visual Basic Editor from the pull
down list at the top right choose KeyPress. In between the words
'Private Sub...' and 'End Sub' paste in the following code.

If Len(TextBox1) = TextBox1.MaxLength - 1 Then
TextBox1 = TextBox1 + Chr$(KeyAscii)
TextBox2.Select
End If

You may call the textboxes whatever you like, TextBox1 for the first
and TextBox2 for the second are just examples. You change their name
by right clicking on the textbox while in Design Mode and choosing
Properties and editing the (Name) entry.

Similarly you need to change the MaxLength entry to be however many
characters you want to allow in the textbox.


--
Posted via Mailgate.ORG Server - http://www.yqcomputer.com/