投稿日 | : 2004/02/04(Wed) 10:58 |
投稿者 | : いちゆ |
Eメール | : |
URL | : |
タイトル | : Re: ゆきの |
EXCEL VBAで作ってみました。
TextBox1とTextBox2を貼り付けて使ってください。
…テストが不十分なので、参考程度です。
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Dim i As Long
Dim st As String
Select Case KeyAscii
Case vbKeyReturn
TextBox2.SetFocus
Case Else
If Len(TextBox1.Text) >= TextBox1_MaxLength Then
KeyAscii = 0
TextBox1.Text = Left$(TextBox1.Text, TextBox1_MaxLength)
TextBox2.SetFocus
Else
TextBox1.SelLength = 0
st = TextBox1.Text
If Mid$(st, TextBox1.SelStart + 1, 1) <> "" Then
i = TextBox1.SelStart
Mid$(st, TextBox1.SelStart + 1, 1) = ChrW$(KeyAscii)
TextBox1.Text = st
TextBox1.SelStart = i + 1
KeyAscii = 0
End If
End If
End Select
End Sub