Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

vba - With a Word ContentControl DatePicker how do i get the value?

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)

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

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.

How do i get the date from the DatePicker ContentControl?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Is this what you are trying?

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

SNAPSHOT

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...