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: Newest
  1. Anonymous
    2012-12-07T04:11:27+00:00

    Error you get when?  What member?  Is there a line of code highlighted when that error message appears?

    I simply don't see how this can be fouled up like this by following the instructions provided. 

    1. Close Word completely.
    2. Open Word
    3. Open the VB Editor

    4.  In the Project Explorer select each project (e.g., Normal, Project1, etc.) one at a time. While each one is selected, on the "Debug" menu, slect "Compile Normal," "Compile Project1"

    Do you get any errors? What precisely are those errors (I can't see it or guess what it is,  you have to describe it in detail).  Do you think any error is in any way related to the activities that you have don regarding this matter over the last two days?  If so, delete whatever it is, be it a module you inserted, a procedure you pasted whatever.

    When all errors are gone.  Repeat the debug process in each project.

    Error free?  Yes - preform steps 1 through nine.

    Results?

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-12-07T03:37:49+00:00

    This is the message I get:

    Compile error:

    Member already exists in an object module from which this object module derives

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2012-12-07T02:55:24+00:00

    Northpaw,

    No need for formalities, Greg is fine.

    This other window you describes means that you or someone else using your computer has at one time experimented with macros and sure enough it got screwed it up. If that window happens to be the active code window and you press F8 then you would get the error you describe. You can delete all the code in that window.

    Don't try to follow two sets of instructions.  Let's stick with 1 through 9 defined above.

    The big windows decribed in step 7 should be completely empty or it may have a single line that reads Option Explicit. In the dropdown bar at the top left of the window it should say "General" in the dropdown at the top right it should say "Declarations."

    When you paste in

    Sub DateLongStamp()

    'Inserts current date

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

    End Sub

    That dropdown on the top right should say "DateLongStamp"

    Now with your cursor somewhere in that big window  start pressing F8.

    Look, I realize that you are trying but if you still can't get it, then send me website feedback and I will reply with a demo document that you can test with.

    Please visit my website:

    http://gregmaxey.mvps.org/word_tips.html

    Was this answer helpful?

    0 comments No comments
  4. 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
  5. 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