[英]Calculate Future Date in MS Word
I am trying to calculate a future date with MS-Word Form Fields. 我正在尝试使用MS-Word表单字段来计算将来的日期。 I pulled this code from http://word.tips.net/T001476_Calculating_a_Future_Date.html , and tried to make it work for me.
我从http://word.tips.net/T001476_Calculating_a_Future_Date.html提取了此代码,并尝试使其对我有用。 It throws an error stating "Object required".
它将引发错误,指出“需要对象”。 The code is within a macro, and the macro is called when the frmApprovalDate field is exited.
该代码在宏内,退出frmApprovalDate字段时将调用该宏。
Dim approvalDate As Date
approvalDate = frmApprovalDate.Text
frmExpirationDate.Text = DateAdd("yyyy", 1, approvalDate)
Any help is appreciated. 任何帮助表示赞赏。 Thanks in advance.
提前致谢。
Is this what you are trying? 这是您要尝试的吗?
Dim approvalDate As Date
approvalDate = ActiveDocument.FormFields("frmApprovalDate").Range.Text
ActiveDocument.FormFields("frmExpirationDate").Result = _
DateAdd("yyyy", 1, approvalDate)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.