使用Word ContentControl DatePicker如何获取值?

问题描述:

我在Word文档中有一个ContentControl,它是一个DatePicker.我正在尝试使用它在后面的代码中填充一些值,但我似乎无法从中获得价值.

I have a ContentControl that is a DatePicker in a word document. I'm trying to use it to populate some value in a code behind but I cant seem to get the value out of it.

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, _
    Cancel As Boolean)

ContentControl上的所有属性均不接近.Value或.Text.我已经看到其他内容控件的用途:

None of the properties on ContentControl are close to .Value or .Text. I have seen other content controls use:

ContentControl.DropdownListEntries(1).Text
ContentControl.DropdownListEntries(1).Value

这对于DatePicker是预期的,但是不起作用,但这是ContentControl的唯一属性,该属性返回的值接近我想要的值.

This, as expected for a DatePicker, does not work but it is the only property of ContentControl that returns anything close to the value I want.

如何从DatePicker ContentControl获取日期?

How do i get the date from the DatePicker ContentControl?

这是您要尝试的吗?

Private Sub Document_ContentControlOnExit(ByVal ContentControl _
As ContentControl, Cancel As Boolean)
    MsgBox ContentControl.Range.Text
End Sub

快照