Private Sub TextBox1_AfterUpdate() TextBox1.Text = Format(CDate(TextBox1.Text), "yyyy/m/d") End Sub
Private Sub TextBox1_AfterUpdate() On Error GoTo Input_err TextBox1.Text = Format(CDate(TextBox1.Text), "yyyy/m/d") Exit Sub Input_err: TextBox1.Text = Format(Now, "yyyy/m/d") End Sub Private Sub TextBox2_AfterUpdate() On Error GoTo Input_err TextBox2.Text = Format(CDate(TextBox2.Text), "HH:mm:ss") Exit Sub Input_err: TextBox2.Text = Format(Now, "HH:mm:ss") End Sub
标签:vba,Sub,Format,Text,文本框,TextBox1,TextBox2,Input,光标 From: https://www.cnblogs.com/Insist-Y/p/16967026.html