Page 1 of 2 12 LastLast
Results 1 to 15 of 18

Thread: AutoInsert Date

  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    England
    Posts
    569
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AutoInsert Date

    Hi,

    I want a template to auto-insert the date from the system clock in Word2000 - how can I do that?
    This should only happen when I trigger the template from a toolbar macro button. It should not happen each time the file is opended for editing by any user.

    Thanks v. much,

    m.q.

  2. #2
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Pune
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoInsert Date

    Dear Musab

    First create a bookmark at the point where the date is to be inserted.
    Next, write the following macro:

    Sub Macro1()
    '
    ' Macro1 Macro
    ' Macro recorded 3/14/01 by Rajesh
    '
    Selection.GoTo What:=wdGoToBookmark, Name:="Date"
    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
    "DATE @ ""dd MMMM yyyy""", PreserveFormatting:=True
    End Sub

    Lastly, assign this macro to an icon on your template toolbar.

    Trust this will meet your need.

    Cheers

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: AutoInsert Date

    If you want the template to insert the date automatically every time a new document based on that template, you should create the macro in the ThisDocument object of the template as follows :

    Private Sub Document_New()
    Selection.GoTo What:=wdGoToBookmark, Name:="Date"
    Selection.InsertDateTime DateTimeFormat:="d MMMM, yyyy", InsertAsField:=False
    Selection.HomeKey Unit:=wdStory
    End Sub

    This macro only runs in the event of a new document being created, and does not run if you open an existing document based on the template. You nee to make sure you have a Bookmark called Date for the above example to run. You can of course change that to whatever suits, or remove the first line altogether. You can also alter the Date Format picture to whatever format you use.

    This inserts the date as a static value, i.e it is not updated. If you want the time entered as a field change InsertAsField:=False to InsertAsField:=True, and the time will update to the current time.

    Hope that works for you

    Andrwe C

  4. #4
    BAM
    Guest

    Re: AutoInsert Date

    Hi m.q.

    If you are creating new files based on your template then use the CreateDate field. (Insert/Field)

    This will insert the creation date of the new file and it will not update.
    ~~~~~~~~~~
    Cheers!

  5. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoInsert Date

    However, having the field there makes it a real PITA if you do need to change the date. For example, I create a letter and save it to disk. Two weeks later I actually get around to printing and mailing the letter, so I have to change the date. That's much easier if the date is in there as just text.
    Legare Coleman

  6. #6
    BAM
    Guest

    Re: AutoInsert Date

    Hi Legare,

    Perhaps you missed what I was referring to. The CreateDate will be the same date the document was created - it will not change on you.

    Or are you wanting to prevent having to type the entire date if you want to change it?

  7. #7
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoInsert Date

    No, I didn't miss what you were saying (I did not write the initial question). In my case, I would want to insert the create date, and I would not want it to change automatically. All I am saying is that I would prefer to have the date inserted as text, not in a field, so that if I do need to change it I can change just the part of the date that needs to be changed. For example, if all I need to change is the day of the month, I don't have to delete the field and retype the entire date.
    Legare Coleman

  8. #8
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoInsert Date

    Hi Legare:

    Another way to insert the date, that I like, is to insert it as a field & then lock it. I have the date field locked in my template. Whenever I create a new document based on that template, the current date is entered, but in a locked field. If it takes me two weeks to finish the letter, I just unlock the field & update it, then lock it again.

  9. #9
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoInsert Date

    What is the advantage of having it in a field, locked or unlocked, vs plain text if it is a fixed value that is not going to change?
    Legare Coleman

  10. #10
    Lounger
    Join Date
    Jan 2001
    Location
    Milton Keynes, Buckinghamshire, England
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoInsert Date

    Phil,

    Another question related to Legare's: How can one tell whether or not a field is locked?

  11. #11
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoInsert Date

    I'm assuming that it can change. By having it in a letter template, for example, letters that are written & mailed the same day, have the current date. Letters (or whatever) that take several days can be changed to the date of mailing. And if you need to resend the letter months later with a new date, you can unlock the field, print it, & close it without saving. In the long run, it's probably just a matter of preference, as it takes very little time to change a date.

  12. #12
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoInsert Date

    You can put the mouse over it & right click; if it's locked, there won't be an update option. But you raise a good point. I wish there were a visual way to know; like a different shading.

  13. #13
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoInsert Date

    Bu a file has only one create date. Therefore, if you insert a field with the create date, it should never change. If the field is print date, or save date, or current date, etc., then yes those do change and it makes sense to have those in a field. If I am going to insert the create date, I prefer to use a macro to insert it as text because that is much less trouble to change manually when I have to change it. If I need to change the date from 25 December 2001 to 26 December 2001, I just have to hilite one character and type one character. If it was a create date field, I would have to delete the field and type the entire date.
    Legare Coleman

  14. #14
    Lounger
    Join Date
    Jan 2001
    Location
    Milton Keynes, Buckinghamshire, England
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoInsert Date

    Thanks for that tip, Phil. It's useful to be reminded of the right mouse click, and the extrra options it offers.

  15. #15
    BAM
    Guest

    Re: AutoInsert Date

    <<as it takes very little time to change a date>>

    Ahh.... I remember the days when changing a date meant that you had to retype the entire letter on a typewriter! <grin>

Page 1 of 2 12 LastLast

Posting Permissions

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