如何在Excel VBA中使用输入掩码? [英] How to use an input mask in excel vba?

查看:137
本文介绍了如何在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.

推荐答案

这篇文章可能会帮助您...

This post may help you...

在VBA的文本框中格式化MM/DD/YYYY日期

这篇关于如何在Excel VBA中使用输入掩码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆