Insert date and time in Word

Anonymous
2012-12-03T03:18:02+00:00

In Region and Language when I set the date as follows:  dddd, MMMM d, yyyy   It shows this way:  ‎Sunday, ‎December ‎2, ‎2012  Yet when I use the insert date and time in Word it comes out:  Sunday, December 02, 2012   Until this latest Windows or Vista I never had this problem. Any ideas?

I use Windows 7, Microsoft Word 2007.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

43 answers

Sort by: Oldest
  1. Anonymous
    2012-12-06T20:29:08+00:00

    The "Project Explorer" is the "Project" pane in the VB Editor.

    Press Alt+F11 to display the VB Editor.  If not displayed, display the Project Explorer pane by using the VB Editor "View" menu and select "Project Explorer."

    It is is becoming clear to me that my instrutions for installing and employing a macro are not as clear or helpful as I had hoped they would be.  If you don't mind, and if you get it sorted out, please send me feedback as to what you think I should change to make it easier to understand.

     

    • I locate and select the project in Project Explorer.
    • Use the VBE "Insert" menu to insert a new standard module.
    • Select the new module and use the Properties Window "Name" property to give my new module a meaningful name (e.g., I often name my modules modMain).
    • Paste my procedure into the main code pane.

    I then immediately step through the new procedure using F8 or run the procedure using the VBE toolbar or menu commands.

    I did the above and named it DateDoneRight and then F8 and I get "Compile error invalid outside procedure"

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-12-06T20:58:31+00:00

    What do you mean "... and named it DateDoneRight"?

    It is already named DateLongStamp.

    1.  Close down Word, then open Word

    1. Open the VBE (Alt+F11)

    3. Locate and select the project in the Project Explorer (Project pane).  The project  you select will be called "Project (Document 1).

    4.  Expand that tree (click the little + sign on the left)

    5.  Expand the Microsoft Word Object tree (click the little + sign on the left)

    1. Dbl-Click "ThisDocument"
    2. In the big empty code window on the right of the VBE, paste in:

    Sub DateLongStamp()

     'Inserts current date

     Selection.InsertDateTime DateTimeFormat:="dddd, MMMM d, yyyy", InsertAsField:=False

    End Sub

    8.  Press the F8 key (three times to step through the code) or press F5 to run the code, or press "Run>Run Sub/Userform" on the VB Editor menu.

    9.  Close the VBE and look at your document.

    What is the result?

    Was this answer helpful?

    0 comments No comments
  3. Doug Robbins - MVP - Office Apps and Services 323.6K Reputation points MVP Volunteer Moderator
    2012-12-06T21:50:05+00:00

    That is what I had to do.

    The thing is that with the Long Date set at dddd, MMMM dd, yyyy in the Control Panel, with English (U.S.) selected in the Insert Date dialog, the result is dddd, MMMM dd, yyyy.  However if English (Aus) is selected in that dialog, the result is dddd, d MMMM yyyy.  Now one can anticipate the day coming before the month for Australian English, but where did the second d go to.  One would expect dddd, dd MMMM yyyy based on the Control Panel Long Date setting

    Was this answer helpful?

    0 comments No comments
  4. Suzanne S Barnhill 279.5K Reputation points MVP Volunteer Moderator
    2012-12-06T23:22:17+00:00

    The variation per country setting is certainly odd, but if the OP is not changing country, then Word ought to be using the format selected.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2012-12-07T02:28:00+00:00

    What do you mean "... and named it DateDoneRight"?

     

    It is already named DateLongStamp.

    1.  Close down Word, then open Word

    1. Open the VBE (Alt+F11)

    3. Locate and select the project in the Project Explorer (Project pane).  The project  you select will be called "Project (Document 1).

    4.  Expand that tree (click the little + sign on the left)

    5.  Expand the Microsoft Word Object tree (click the little + sign on the left)

    1. Dbl-Click "ThisDocument"
    2. In the big empty code window on the right of the VBE, paste in:

    Sub DateLongStamp()

     'Inserts current date

     Selection.InsertDateTime DateTimeFormat:="dddd, MMMM d, yyyy", InsertAsField:=False

    End Sub

    8.  Press the F8 key (three times to step through the code) or press F5 to run the code, or press "Run>Run Sub/Userform" on the VB Editor menu.

    9.  Close the VBE and look at your document.

     

    What is the result?

    Mr Maxey,

    I got the idea of DateDoneRight from your instructions to name it something:

     

    "Select the new module and use the Properties Window "Name" property to give my new module a meaningful name (e.g., I often name my modules modMain)."

    So I named it something.

     

    To your latest instructions I did each step as instructed and got:

    “Compile error invalid outside procedure”, again. 

    I notice that another large white box opened that reads

    "Normal – AutoCorrect Utility(Code) and inside that is the following:"

     

    Option Explicit

     

    frmAutoCorrect.Show

     

    End Sub

    Was this answer helpful?

    0 comments No comments