如何在Excel VBA中使用输入掩码?
请仔细阅读该问题,其中提到EXCEL VBA.不太好
READ CAREFULLY THE QUESTION PLEASE, IT MENTIONS EXCEL VBA. NOT EXCEL
我承担了在VBA表单上固定日期输入的任务.文本框应让用户以 MM/DD/YYYY
输入日期.
I was given the task of fixing a date input on a VBA form. A textbox should have the user enter the date as MM/DD/YYYY
.
我必须使用输入掩码,不允许在日历之后或使用日历做某些事情来验证日期.到目前为止,我已经能够使用上述2种方法(在使用 ISDATE
后强制使用格式).
I am required to use an input mask, not allowed to do something as validating date after or using a calendar. So far I was able to use the 2 methods mentioned (forcing the format after using ISDATE
).
但是,现在已经明确表示它是必须是掩码,因此在输入时会过滤键,并且在输入日期时可以看到掩码: __/__/____
However, it has now been made clear it has to be a mask so keys are filtered on entry, with the mask being visible when entering the date: __/__/____
在看到下划线的地方,他应该只能输入数字,并且/始终位于这些位置
Where you see underscore, he should only be able to enter numbers and the / are always at those positions
有没有办法做到这一点?我只能在Access VBA中找到有关掩码的教程.
Is there a way to do this? I can only find a tutorial for the mask in Access VBA.