Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果用户将文本框留空,我想阻止代码执行
If tx01.Value = "" Then Exit Sub If tx01.Value = vbNullString Then Exit Sub // also tried
但是用户可以简单地写一个空格(或任意数量的空格)并且 - 预防不起作用。 我需要此框中的字符(数字和非数字),但不仅是空格。 请问我该怎么做?
尝试Trim()在文本框值检查中添加一个。
Trim()
就像是
if trim(tx01.Value) = "" then Exit sub
Trim 删除前导和尾随空白字符。