View Single Post
 
Old 05-23-2012, 09:29 AM
jjfreedman jjfreedman is offline Windows 7 64bit Office 2010 32bit
Advanced Beginner
 
Join Date: May 2012
Location: https://jay-freedman.info
Posts: 39
jjfreedman is on a distinguished road
Default

If you want a date picker on a userform, first you need to get and register the file mscal.ocx. For that, visit http://www.fontstuff.com/vba/vbatut07.htm. Step 2 on that page also explains how to put the control on the toolbox and how to use it. The drawback here is that you need to have the ocx on every computer that will use the form, and it's no longer common.

If you stick with the content control, then you can get its value with the expression ActiveDocument.ContentControls(1).Range.Text -- just substitute the correct index in the parentheses to get the particular control you need. Alternatively, put a unique Tag value in that control, and use the ActiveDocument.SelectContentControlsByTag method to get the correct one. (That method returns a collection of content controls, but if your tag is unique then you know the collection contains only one control, so you can use the index 1 to get the control.)
Reply With Quote