|
你再试试:Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Call aaa
Call fff
With TextBox1
If Len(Trim(TextBox1.Text)) = 11 Then
If KeyCode = vbKeyReturn Then
Range("a" & Cells(1).End(3).Row).Offset(0).Value = Mid(.Text, 8, 4)
.Text = ""
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Call 光标复位
End If
ElseIf Len(Trim(TextBox1.Text)) <> 11 Then
If KeyCode = vbKeyReturn Then
MsgBox ("此号码 ") & .Text & (" 错误,")
Cancel = True
End If
End If
End With
End Sub
'重置单元格数据
Sub aaa()
Range("A:A").ClearContents
End Sub
'与系统时间同步
Sub fff()
[a7] = WorksheetFunction.Text(Now(), "yyyy-mm-dd h:mm:ss")
'Application.OnTime Now + TimeValue("00:00:01"), "与系统时间同步"
End Sub
|
|