Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Oct 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Remove comment dates (Word XP)

    Is it possible to remove the dates in a comment? I want to keep the comment as a balloon, but I want to remove notice of when they were made.

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Remove comment dates (Word XP)

    Hi,

    I have Word 200, not XP, and Word 2000 doesn't have a 'date' attribute for comments - only an 'author' attribute. In Word 2000, 'author' is a property of the Comment object and can be changed, as in:
    If ActiveDocument.Comments.Count >= 1 Then
    With ActiveDocument.Comments(1)
    .Author = "Joe Smith"
    .Initial = "JAS"
    End With
    End If

    (from the Word help file)

    You may find that the date in XP can also be edited this way, though you may not be able to delete it.

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove comment dates (Word XP)

    Date is a property of the Comment object in Word 2002 (XP) VBA, but it is read-only, you cannot modify it.

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Remove comment dates (Word XP)

    This Macro will delete all comments in the document and add them back. It preserves the Author, Initials, Text and Range - but sets the date/time to the time it runs.

    StuartR


    Sub CommentDatesToNow()

    Dim i As Integer
    Dim cmntNew As Comment
    Dim strAuthor As String
    Dim strInitial As String
    Dim strText As String
    Dim rngPosition As Range

    For i = ActiveDocument.Comments.Count To 1 Step -1
    With ActiveDocument.Comments(i)
    strAuthor = .Author
    strInitial = .Initial
    strText = .Range.Text
    Set rngPosition = .Reference.Duplicate
    .Delete
    End With
    Set cmntNew = ActiveDocument.Comments.Add(Range:=rngPosition, Text:=strText)
    cmntNew.Author = strAuthor
    cmntNew.Initial = strInitial
    Next i

    Set cmntNew = Nothing
    Set rngPosition = Nothing

    End Sub

  5. #5
    New Lounger
    Join Date
    Oct 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove comment dates (Word XP)

    That code worked flawlessly and fast. I am not that familiar with the macro language, but I am guessing that this macro inserts a duplicate and then deletes the original, which leaves the comment with the present date. Given the other posts in the thread, it seems like the date in a comment cannot simply be deleted but only reset to the present. Is this correct?

    Thanks,

    cbran250

  6. #6
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Remove comment dates (Word XP)

    Absolutely correct. The code stores the Author, Initials, Text and Document Range from the original comment, then deletes it and adds it back again. If you had fancy font formatting, embedded fields or other unusual things in comments they would get lost - but it works fine for standard comments.

    StuartR

Posting Permissions

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