none
Extract Text from Comment to Paragraph RRS feed

  • Question

  • Hi All,

    I've been looking  for a method to Read the word comment text and Insert them at beginning or end of the paragraph with some modifications. 

    I'm not sure that this is possible. How can i identify the paragraph which the comment is put on. 

    Following is the scenario which I try to achieve:

    BeforeAfter


    Please Help me out if anyone know about handling word comments. Thanks in advance.


    Regards, Supun Samarakoon

    Thursday, June 14, 2018 6:11 AM

Answers

  • Try this macro:

    Sub Comment2Text()
        Dim i As Long
        Application.ScreenUpdating = False
        For i = ActiveDocument.Comments.Count To 1 Step -1
            With ActiveDocument.Comments(i)
                .Reference.Paragraphs(1).Range.InsertBefore "####" & .Range.Text & "####"
                .DeleteRecursively
            End With
        Next i
        Application.ScreenUpdating = True
    End Sub


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by Supunsam Friday, June 15, 2018 3:30 AM
    Thursday, June 14, 2018 8:39 AM

All replies

  • Try this macro:

    Sub Comment2Text()
        Dim i As Long
        Application.ScreenUpdating = False
        For i = ActiveDocument.Comments.Count To 1 Step -1
            With ActiveDocument.Comments(i)
                .Reference.Paragraphs(1).Range.InsertBefore "####" & .Range.Text & "####"
                .DeleteRecursively
            End With
        Next i
        Application.ScreenUpdating = True
    End Sub


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by Supunsam Friday, June 15, 2018 3:30 AM
    Thursday, June 14, 2018 8:39 AM
  • Hello Hans,

    Thank you very much. It works. I had to change DeleteRecursively to Delete. I think that command is not working anymore. 


    Regards, Supun Samarakoon

    Friday, June 15, 2018 3:32 AM