Consulting

Results 1 to 5 of 5

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
    3,085
    Location
    Cheers
    Paul Edstein
    [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
    3,085
    Location
    Simply insert:
    .Duplicate.InsertAfter " day of"
    before:
    .InsertAfter Ordinal(Val(j))
    Cheers
    Paul Edstein
    [MS MVP - Word]

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

Posting Permissions

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