Consulting

Results 1 to 9 of 9

Thread: Ordinal Date with Date Picker Content Control

  1. #1

    Ordinal Date with Date Picker Content Control

    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?

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    That code gets me the following result:

    7th July, 2017

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

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Simply insert:
    .Duplicate.InsertAfter " day of"
    before:
    .InsertAfter Ordinal(Val(j))
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    Perfect. Works like a charm. Thanx Paul.

  6. #6
    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

  7. #7
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Quote Originally Posted by Smtzakula View Post
    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.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  8. #8
    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.

  9. #9
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    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.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •