Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2003
    Location
    Greeley, Colorado
    Posts
    188
    Thanks
    8
    Thanked 1 Time in 1 Post

    date time stamp on every line of a word document

    Is there a way to do this with vba in Word 2010? Like line numbering, but automatically putting the data/time stamp at the front of every line and/or paragraph.

    Sry for cross post in Word forum.

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    The logical way to do this would be to make use of the revision tracking function of Word. This quick and dirty solution could quickly become very ugly especially if there are multiple revisions in the same paragraph but this code will get you started on the concept if you have turned revision tracking on in your document and then made some changes.
    Code:
    Sub TagParasWithRevDate()
      Dim aRev As Revision, aPara As Paragraph
      For Each aRev In ActiveDocument.Revisions
        Debug.Print aRev.Date
        For Each aPara In aRev.Range.Paragraphs
          aPara.Range.InsertBefore aRev.Date & vbTab
        Next aPara
      Next aRev
    End Sub
    You will need to refine this code to take only the last revision in a paragraph and remove existing date/times before inserting a new one.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    I've seen macros for this, but I can't remember what they were called. I thing it was for some kind of logging, and each paragraph was very short, so it didn't get too ugly.

Posting Permissions

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