Microsoft Office Excel ® Kod Kılavuzu

Microsoft Office Excel® Code Guide

20 Eylül 2004 Pazartesi

Date Text Format




'UserForm1

Private Sub UserForm_Initialize()
On Error Resume Next
Me.Caption = "[PBİD®] Date Text Format..."
With TextBox1
.MaxLength = 10
.EnterFieldBehavior = fmEnterFieldBehaviorRecallSelection
.Text = "##.##.####"
.SelStart = 0
.SelLength = 1
End With
End Sub
Private Sub TextBox1_Change()
On Error Resume Next
With TextBox1
.SelLength = 1
If .SelText = "." Then
.SelStart = .SelStart + 1
.SelLength = 1
End If
End With
End Sub
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
On Error GoTo Hata:
With TextBox1
If KeyCode = vbKeyLeft Or KeyCode = vbKeyBack Then
KeyCode = vbKeySelect
.SelStart = .SelStart - 1
.SelLength = 1
ElseIf KeyCode = vbKeyRight Then
KeyCode = vbKeySelect
.SelStart = .SelStart + 1
.SelLength = 1
ElseIf KeyCode = vbKeyDelete Then
KeyCode = vbKeySelect
If .SelText = "." Then
.SelText = "."
Else
.SelText = "#"
End If
.SelStart = .SelStart - 1
.SelLength = 1
ElseIf KeyCode = vbKeyHome Then
KeyCode = vbKeySelect
.SelStart = 0
.SelLength = 1
ElseIf KeyCode = vbKeyEnd Then
KeyCode = vbKeySelect
.SelStart = Len(TextBox1) - 1
.SelLength = 1
End If
End With
Exit Sub
Hata:
KeyCode = vbKeySelect
TextBox1.SelStart = 0
TextBox1.SelLength = 1
End Sub

Hiç yorum yok:

Blog Arşivi

Bu gadget'ta bir hata oluştu

Bu Blogda Ara

Contributor

Contributor
Mustafa ULUSARAÇ İstanbul, TÜRKİYE
free counters
T. C. Central Bank Indicative Exchange Rates
Currency Exchange Rate Widget,Currency Converter Widget
Borsa İstanbul