How to export all comments from an Excel file to Word

Here is the VBA macro which export the comments in the active sheet to a newly created Word file:

Sub extractComments()
    Dim xComment As Comment
    Dim wApp As Object
    On Error Resume Next
Set wApp = GetObject(, "Word.Application")

If Err.Number <> 0 Then
        Set wApp = CreateObject("Word.Application")
End If

    wApp.Visible = True
    wApp.Documents.Add DocumentType:=0

For Each xComment In Application.ActiveSheet.Comments
        wApp.Selection.TypeText xComment.Parent.Value & vbTab & xComment.Parent.Address & vbTab & xComment.Text

Set wApp = Nothing
End Sub

Source. Added cell value into the code above

Spread the word!

Leave a Reply

Your email address will not be published. Required fields are marked *