gpt4 book ai didi

How to incorporate popup calendarform into an existing Userform(如何将弹出日历表单合并到现有用户表单中)

转载 作者:bug小助手 更新时间:2023-10-24 20:20:24 32 4
gpt4 key购买 nike



I'm very impressed by Trevor Eyre's version of the pop up calendar (answer # 11) and was excited to incorporate into a Userform that I am developing, which is challenging as I have VERY basic experience with VBA.

我对Trevor Eyre版本的弹出式日历印象非常深刻(答案11),我很兴奋能将其整合到我正在开发的用户表单中,这是具有挑战性的,因为我有非常基本的VBA经验。



Formatting MM/DD/YYYY dates in textbox in VBA (Answer # 11)
Link to the example spreadsheet of Trevors https://www.dropbox.com/sh/0n9gyc32rlr31n2/AAAW7ADAWiLEZRHftERro9Tva?dl=0

在VBA中设置文本框中MM/DD/YYYY日期的格式(答案11)指向Trevors https://www.dropbox.com/sh/0n9gyc32rlr31n2/AAAW7ADAWiLEZRHftERro9Tva?dl=0示例电子表格的链接



For example, I have a userform named SECINC and have a text box (IncidentDate) where the user would have had to enter the date of the incident, until I came across Trevor's version of the pop up calendar. I am on Excel 2013 (64 bit) and the MS date picker is not available.

例如,我有一个名为SECINC的用户表单,还有一个文本框(InsidentDate),用户必须在其中输入事件的日期,直到我看到Trevor版本的弹出式日历。我使用的是Excel 2013(64位),MS日期选择器不可用。



I have copied over all the code from the module1 into module1 of my project book and have saved and imported the CalendarForm and then I have my own userform, Refer to link:

Example of SECINC userform

我已经将所有代码从模块1复制到我的项目手册的模块1中,并保存并导入了CalendarForm,然后我有了自己的用户表单,请参阅链接:SECINC用户表单的示例



I am happy to use just the basic CalendarForm as is, but the one thing I am missing is how do I call up the Calendar form when the user clicks the IncidentDate textbox and the selected date populates that IncidentDate box.

我很乐意按原样使用基本的CalendarForm,但我缺少的一件事是,当用户单击开始日期文本框并且所选日期填充该开始日期框时,如何调用日历表单。



I have added an 'image' of a calendar and wondering how I link it to the CalendarForm so that when it is clicked it will open the Calendar and drop the date into the IncidentDate textbox.

我添加了一个日历的‘图像’,我想知道如何将它链接到CalendarForm,这样当它被点击时,它就会打开日历,并将日期放到InsidentDate文本框中。



I would need the date format in the IncidentDate textbox to display in DD/MM/YY format.

我需要在开始日期文本框中的日期格式以DD/MM/YY格式显示。



I was thinking that perhaps it would be advantage for us who are visually based, to see it in the form of a video tutorial and for those of use who are new to VBA.

我在想,对于我们这些基于视觉的人来说,以视频教程的形式观看它可能会有好处,对于那些刚刚接触VBA的人来说也是如此。



If I have confused you, or you require further information, please advise.

如果我让你感到困惑,或者你需要进一步的信息,请告知。



Thanking you in advance,

先感谢你,



TheShyButterfly

《蝴蝶集》


更多回答
优秀答案推荐

You need a click event on your image, that will call the calendar and fill in the date field

您需要在您的图像上有一个Click事件,它将调用日历并填写日期字段



Right click on the calendar image and choose "view code" to create the click event sub.
Then add the command below as specified on Trevor's answer:

在日历图像上单击鼠标右键并选择“查看代码”以创建单击事件子对象。然后按照Trevor的回答添加下面的命令:



Private Sub Image1_Click()
your_date_field_name.Value = CalendarForm.GetDate
End Sub


Try to be a bit less "literal" next time you ask a question, we don't need that much details for such a simple question, it's confusing. I suggest you to read this

下次你问问题时,尽量不要那么直截了当,我们不需要这么简单的问题有那么多细节,这很令人困惑。我建议你读读这篇文章


更多回答

Thank you Thomas G, your code worked beautifully, and I will reduce my 'literal' in future.

谢谢你,Thomas G,你的代码运行得很好,我会在未来减少我的‘字面’。

@TheShyButterfly you are welcome but If my answer addresses the question, please mark it as accepted, and an upvote is welcome too ;-)

@TheShyButterly欢迎您,但如果我的回答解决了问题,请将其标记为已接受,也欢迎您投赞成票;-)

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com