Guustaaf


Hi pals and gals,

Could someone help me with the following problem

I have a userform in wich the user types personal data of new employees.

Now i want the text in the textboxes to automaticly change into the correct format at BeforeUpdate.

example:

Private Sub txtVoorletters_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
txtVoorletters.Value = StrConv(txtVoorletters, vbUpperCase)
End Sub

Now i want to add a function that inserts periods between initials.

So when the user types "ABCD" the function converts this string to: "A.B.C.D."

Any idea

Thanks in advance

Guus van Waardenburg




Re: Inserting additional chars into a string....

Andy Pope


Hi,

How about this,

Dim strTemp As String
Dim lngIndex As Long

strTemp = UCase(TextBox1.Text)
For lngIndex = Len(strTemp) To 1 Step -1
strTemp = Left(strTemp, lngIndex) & "." & Mid(strTemp, lngIndex + 1)
Next

TextBox1.Text = strTemp







Re: Inserting additional chars into a string....

Guustaaf

Great! Thank you very much!!!