PDA

View Full Version : [SOLVED:] Ordinal Date with Date Picker Content Control



cokemachine
08-29-2017, 03:09 PM
I have a document in Word 2010 that I need users to complete the date in the format d day of MMMM, yyyy ideally using the Date Picker Content Control. I'd also like the day to have a superscripted ordinal. For example when a user chooses the date July 7, 2017 from the Date Picker Content Control the result is displayed:

7th day of July, 2017

Currently I have a Date Picker Content Control titled PerformDate formatted to MMMM, yyyy and a field linked to it with the ordinal switch. This gets me the day with the ordinal, but I still have to manual update the field each time the Date Picker Content Control is updated and I don't know how to automatically superscript the ordinal.

I'm pretty sure that this is not the best approach, but I'm kind of stuck at this point. Any suggestion on code to complete the method I've got going or any ideas of different approaches?

macropod
08-29-2017, 03:20 PM
See: http://www.msofficeforums.com/word/8190-how-custom-date-picker-cc-format-ordinal.html

cokemachine
08-29-2017, 03:41 PM
That code gets me the following result:

7th July, 2017

What code do I have to add to get 7th day of July, 2017?

macropod
08-29-2017, 03:52 PM
Simply insert:
.Duplicate.InsertAfter " day of"
before:
.InsertAfter Ordinal(Val(j))

cokemachine
08-29-2017, 04:07 PM
Perfect. Works like a charm. Thanx Paul.

Smtzakula
11-21-2017, 08:45 AM
I'm a complete newbie to this. However, this is the exact task I am trying to accomplish for a set of about 50 legal templates I need to create. I followed the link, added in the text to get the " day of" result-- and saved it as an XML document which is probably incorrect. Here is where I am completely stuck. How to I get the content control INTO my document to actually use? Could someone link easy to follow instructions on how to do this? I'm pretty intuitive once I am pointed the correct direction. I apologize for the basic question, but we all have to start somewhere, right?

Thank you so much,

Susan

macropod
11-21-2017, 03:28 PM
Here is where I am completely stuck. How to I get the content control INTO my document to actually use?
Go to Developer|Controls>Date Picker Content Control. If the Developer tab isn't displayed on your system, go to File|Options|Customize Ribbon and enable it.

Smtzakula
11-22-2017, 09:08 AM
Thank you. I already had Developer enabled as I use it regularly. My issue is putting the custom code somewhere where the developer tab can find it for me to use it.

macropod
11-22-2017, 01:28 PM
The code goes in the 'ThisDocument' code module of either the document itself or its template. You can access that by pressing Alt-F11, then clicking on the relevant 'ThisDocument' code module on the left side of the screen.