Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Oct 2005
    Location
    Guisborough, United Kingdom
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Saving comments (2)

    <img src=/S/confused3.gif border=0 alt=confused3 width=45 height=45>
    Can anyone tell me how to save comments which I have put in students work via the reviewing mode. I need to have them in a file and also to put em on the last page.
    Help??

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

    Re: Saving comments (2)

    Welcome to the lounge.

    This short Macro will put the text from all your comments at the end of the document.

    StuartR

    <code>Sub GetComments()
    Dim cmntLoop As Comment
    Dim strComments As String

    For Each cmntLoop In ActiveDocument.Comments
    strComments = strComments & vbCrLf & vbCrLf & cmntLoop.Date _
    & vbTab & cmntLoop.Author & vbCrLf & cmntLoop.Range.Text
    Next cmntLoop

    ActiveDocument.Range.InsertAfter strComments

    End Sub
    </code>

  3. #3
    New Lounger
    Join Date
    Oct 2005
    Location
    Guisborough, United Kingdom
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Saving comments (2)

    Thanks for the prompt reply - macro fails at Date and Author
    Mike S

  4. #4
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Saving comments (2)

    I'm afraid I don't see the significance of "Date and Author". -> (Edited - Sorry, now I see what you're referring to. I'll try to have a look if Stuart doesn't jump in first).

    What message appears when the macro fails?
    Is anything appended to the document at all?

    Without being able to test, this modified version might work:
    <pre>Sub GetRevisions()
    Dim revLoop As Revision
    Dim strRevisions As String

    For Each revLoop In ActiveDocument.Revisions
    strRevisions = strRevisions & vbCrLf & vbCrLf & revLoop.Date _
    & vbTab & revLoop.Author & vbCrLf & revLoop.Range.Text
    Next revLoop

    ActiveDocument.Range.InsertAfter strRevisions

    End Sub
    </pre>

    Alan

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

    Re: Saving comments (2)

    That is strange, I did test the code before posting. What version of Word are you running?

    I assume you mean that you get an error message from the line
    <code>
    strComments = strComments & vbCrLf & vbCrLf & cmntLoop.Date _
    & vbTab & cmntLoop.Author & vbCrLf & cmntLoop.Range.Text
    </code>
    What error message are you getting?

    Can you type each of the following lines in the VBE Immediate Window (Control-G to display it if not already visible) and see if you get an error

    ? ActiveDocument.Comments(1).Date
    ? ActiveDocument.Comments(1).Author
    ? ActiveDocument.Comments(1).Range.Text

    (? is an abbreviation for Debug.Print, it just saves a bit of typing)

    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
  •