ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   textbox formatting questions (https://www.excelbanter.com/excel-programming/372162-textbox-formatting-questions.html)

rook

textbox formatting questions
 
Hi!
How do you do the ff:
1. Format a textbox such that the text begins with a capital letter and the
rest are in small caps?
2. Format a textbox such that it follows the telephone number format?
3. Date format?

Need your help.

Rook

Norman Jones

textbox formatting questions
 
Hi Rook,

Try:

With TextBox1
.Value = StrConv(.Value, vbProperCase)
'Or
.Value = Format(.Value, "dd/mm/yy")
End With

I am not aware of a telehone number format, certainly, but you can use a
custom format of your choice


---
Regards,
Norman



"Rook" wrote in message
...
Hi!
How do you do the ff:
1. Format a textbox such that the text begins with a capital letter and
the
rest are in small caps?
2. Format a textbox such that it follows the telephone number format?
3. Date format?

Need your help.

Rook




rook

textbox formatting questions
 
Hi Norman.

I tried what you suggested but everytime I key in the second character the
textbox automatically formats it. Did I miss anything in the property?

Thanks

Rook

"Norman Jones" wrote:

Hi Rook,

Try:

With TextBox1
.Value = StrConv(.Value, vbProperCase)
'Or
.Value = Format(.Value, "dd/mm/yy")
End With

I am not aware of a telehone number format, certainly, but you can use a
custom format of your choice


---
Regards,
Norman



"Rook" wrote in message
...
Hi!
How do you do the ff:
1. Format a textbox such that the text begins with a capital letter and
the
rest are in small caps?
2. Format a textbox such that it follows the telephone number format?
3. Date format?

Need your help.

Rook





Norman Jones

textbox formatting questions
 
Hi Rook,

Where did you put the code?

I tried using a CommandButton or the TextBox's Exit event:

'=============
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With TextBox1
.Value = StrConv(.Value, vbProperCase)
'Or
.Value = Format(.Value, "dd/mm/yy")
End With
End Sub
'<<=============


---
Regards,
Norman



"Rook" wrote in message
...
Hi Norman.

I tried what you suggested but everytime I key in the second character the
textbox automatically formats it. Did I miss anything in the property?

Thanks

Rook

"Norman Jones" wrote:

Hi Rook,

Try:

With TextBox1
.Value = StrConv(.Value, vbProperCase)
'Or
.Value = Format(.Value, "dd/mm/yy")
End With

I am not aware of a telehone number format, certainly, but you can use a
custom format of your choice


---
Regards,
Norman



"Rook" wrote in message
...
Hi!
How do you do the ff:
1. Format a textbox such that the text begins with a capital letter and
the
rest are in small caps?
2. Format a textbox such that it follows the telephone number format?
3. Date format?

Need your help.

Rook







rook

textbox formatting questions
 
Hi Norman,

I put the code within a sub - see below (courtesy of Bob Phillips):

Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
Dim fBackwards As Boolean
Const ctlPrev As String = "TextBox3"
Const ctlNext As String = "TextBox2"

Select Case KeyCode
Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp
Application.ScreenUpdating = False
fBackwards = CBool(Shift And 1) Or (KeyCode = vbKeyUp)
If Application.Version < 9 Then ActiveSheet.Range("A1").Select
If fBackwards Then
ActiveSheet.OLEObjects(ctlPrev).Activate
Else
ActiveSheet.OLEObjects(ctlNext).Activate
End If
Application.ScreenUpdating = True
End Select
End Sub


Thanks

Rook


"Norman Jones" wrote:

Hi Rook,

Where did you put the code?

I tried using a CommandButton or the TextBox's Exit event:

'=============
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With TextBox1
.Value = StrConv(.Value, vbProperCase)
'Or
.Value = Format(.Value, "dd/mm/yy")
End With
End Sub
'<<=============


---
Regards,
Norman



"Rook" wrote in message
...
Hi Norman.

I tried what you suggested but everytime I key in the second character the
textbox automatically formats it. Did I miss anything in the property?

Thanks

Rook

"Norman Jones" wrote:

Hi Rook,

Try:

With TextBox1
.Value = StrConv(.Value, vbProperCase)
'Or
.Value = Format(.Value, "dd/mm/yy")
End With

I am not aware of a telehone number format, certainly, but you can use a
custom format of your choice


---
Regards,
Norman



"Rook" wrote in message
...
Hi!
How do you do the ff:
1. Format a textbox such that the text begins with a capital letter and
the
rest are in small caps?
2. Format a textbox such that it follows the telephone number format?
3. Date format?

Need your help.

Rook








All times are GMT +1. The time now is 12:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com